From 019cbce01db19705b896bbf0936b22a582e573cc Mon Sep 17 00:00:00 2001 From: Christoph Knittel Date: Thu, 26 Sep 2024 16:08:54 +0200 Subject: [PATCH] ReScript 12 compatibility workaround (#93) --- src/S_Core.bs.mjs | 8 ++++++-- src/S_Core.res | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/S_Core.bs.mjs b/src/S_Core.bs.mjs index 8dbc5cf..4449695 100644 --- a/src/S_Core.bs.mjs +++ b/src/S_Core.bs.mjs @@ -2356,6 +2356,10 @@ function reason(error, nestedLevelOpt) { } } +function reason$1(error) { + return reason(error, undefined); +} + function message(error) { var match = error.operation; var operation; @@ -2379,7 +2383,7 @@ function message(error) { } var nonEmptyPath = error.path; var pathText = nonEmptyPath === "" ? "root" : nonEmptyPath; - return "Failed " + operation + " at " + pathText + ". Reason: " + reason(error); + return "Failed " + operation + " at " + pathText + ". Reason: " + reason(error, undefined); } function internalInline(schema, maybeVariant, param) { @@ -3087,7 +3091,7 @@ var $$Error$1 = { make: make$1, raise: raise$1, message: message, - reason: reason + reason: reason$1 }; var Literal = { diff --git a/src/S_Core.res b/src/S_Core.res index 465ecc4..dfd24ec 100644 --- a/src/S_Core.res +++ b/src/S_Core.res @@ -3473,7 +3473,7 @@ module Error = { } } - let reason = reason->(Obj.magic: ((error, ~nestedLevel: int=?) => string) => error => string) + let reason = error => reason(error) let message = (error: error) => { let operation = switch error.operation {