brepjs 4.0.2 → 4.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/brepjs.cjs +8 -1
- package/dist/brepjs.js +8 -1
- package/package.json +1 -1
package/dist/brepjs.cjs
CHANGED
|
@@ -1109,9 +1109,16 @@ function andThen(result, fn) {
|
|
|
1109
1109
|
return result;
|
|
1110
1110
|
}
|
|
1111
1111
|
const flatMap = andThen;
|
|
1112
|
+
function formatError(error) {
|
|
1113
|
+
if (typeof error === "object" && error !== null && "kind" in error && "code" in error && "message" in error) {
|
|
1114
|
+
const e = error;
|
|
1115
|
+
return `[${e.kind}] ${e.code}: ${e.message}`;
|
|
1116
|
+
}
|
|
1117
|
+
return String(error);
|
|
1118
|
+
}
|
|
1112
1119
|
function unwrap(result) {
|
|
1113
1120
|
if (result.ok) return result.value;
|
|
1114
|
-
throw new Error(`Called unwrap() on an Err: ${
|
|
1121
|
+
throw new Error(`Called unwrap() on an Err: ${formatError(result.error)}`);
|
|
1115
1122
|
}
|
|
1116
1123
|
function unwrapOr(result, defaultValue) {
|
|
1117
1124
|
if (result.ok) return result.value;
|
package/dist/brepjs.js
CHANGED
|
@@ -1107,9 +1107,16 @@ function andThen(result, fn) {
|
|
|
1107
1107
|
return result;
|
|
1108
1108
|
}
|
|
1109
1109
|
const flatMap = andThen;
|
|
1110
|
+
function formatError(error) {
|
|
1111
|
+
if (typeof error === "object" && error !== null && "kind" in error && "code" in error && "message" in error) {
|
|
1112
|
+
const e = error;
|
|
1113
|
+
return `[${e.kind}] ${e.code}: ${e.message}`;
|
|
1114
|
+
}
|
|
1115
|
+
return String(error);
|
|
1116
|
+
}
|
|
1110
1117
|
function unwrap(result) {
|
|
1111
1118
|
if (result.ok) return result.value;
|
|
1112
|
-
throw new Error(`Called unwrap() on an Err: ${
|
|
1119
|
+
throw new Error(`Called unwrap() on an Err: ${formatError(result.error)}`);
|
|
1113
1120
|
}
|
|
1114
1121
|
function unwrapOr(result, defaultValue) {
|
|
1115
1122
|
if (result.ok) return result.value;
|