effect 3.14.21 → 3.14.22
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/cjs/Schema.js +14 -5
- package/dist/cjs/Schema.js.map +1 -1
- package/dist/cjs/internal/version.js +1 -1
- package/dist/dts/Schema.d.ts.map +1 -1
- package/dist/esm/Schema.js +14 -5
- package/dist/esm/Schema.js.map +1 -1
- package/dist/esm/internal/version.js +1 -1
- package/package.json +1 -1
- package/src/Schema.ts +19 -8
- package/src/internal/version.ts +1 -1
package/dist/esm/Schema.js
CHANGED
|
@@ -4788,7 +4788,8 @@ export const TaggedError = identifier => (tag, fieldsOr, annotations) => {
|
|
|
4788
4788
|
_tag: getClassTag(tag)
|
|
4789
4789
|
};
|
|
4790
4790
|
const taggedFields = extendFields(newFields, fields);
|
|
4791
|
-
|
|
4791
|
+
const hasMessageField = "message" in taggedFields;
|
|
4792
|
+
class TaggedErrorClass extends makeClass({
|
|
4792
4793
|
kind: "TaggedError",
|
|
4793
4794
|
identifier: identifier ?? tag,
|
|
4794
4795
|
schema: extend(schema, Struct(newFields)),
|
|
@@ -4798,10 +4799,18 @@ export const TaggedError = identifier => (tag, fieldsOr, annotations) => {
|
|
|
4798
4799
|
disableToString: true
|
|
4799
4800
|
}) {
|
|
4800
4801
|
static _tag = tag;
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
|
|
4802
|
+
}
|
|
4803
|
+
if (!hasMessageField) {
|
|
4804
|
+
Object.defineProperty(TaggedErrorClass.prototype, "message", {
|
|
4805
|
+
get() {
|
|
4806
|
+
return `{ ${util_.ownKeys(fields).map(p => `${util_.formatPropertyKey(p)}: ${util_.formatUnknown(this[p])}`).join(", ")} }`;
|
|
4807
|
+
},
|
|
4808
|
+
enumerable: false,
|
|
4809
|
+
// mirrors the built-in Error.prototype.message, whose descriptor is also non-enumerable
|
|
4810
|
+
configurable: true
|
|
4811
|
+
});
|
|
4812
|
+
}
|
|
4813
|
+
return TaggedErrorClass;
|
|
4805
4814
|
};
|
|
4806
4815
|
const extendFields = (a, b) => {
|
|
4807
4816
|
const out = {
|