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/package.json
CHANGED
package/src/Schema.ts
CHANGED
|
@@ -9302,7 +9302,8 @@ export const TaggedError = <Self = never>(identifier?: string) =>
|
|
|
9302
9302
|
const schema = getSchemaFromFieldsOr(fieldsOr)
|
|
9303
9303
|
const newFields = { _tag: getClassTag(tag) }
|
|
9304
9304
|
const taggedFields = extendFields(newFields, fields)
|
|
9305
|
-
|
|
9305
|
+
const hasMessageField = "message" in taggedFields
|
|
9306
|
+
class TaggedErrorClass extends makeClass({
|
|
9306
9307
|
kind: "TaggedError",
|
|
9307
9308
|
identifier: identifier ?? tag,
|
|
9308
9309
|
schema: extend(schema, Struct(newFields)),
|
|
@@ -9312,13 +9313,23 @@ export const TaggedError = <Self = never>(identifier?: string) =>
|
|
|
9312
9313
|
disableToString: true
|
|
9313
9314
|
}) {
|
|
9314
9315
|
static _tag = tag
|
|
9315
|
-
|
|
9316
|
-
|
|
9317
|
-
|
|
9318
|
-
|
|
9319
|
-
|
|
9320
|
-
|
|
9321
|
-
|
|
9316
|
+
}
|
|
9317
|
+
|
|
9318
|
+
if (!hasMessageField) {
|
|
9319
|
+
Object.defineProperty(TaggedErrorClass.prototype, "message", {
|
|
9320
|
+
get() {
|
|
9321
|
+
return `{ ${
|
|
9322
|
+
util_.ownKeys(fields)
|
|
9323
|
+
.map((p: any) => `${util_.formatPropertyKey(p)}: ${util_.formatUnknown((this)[p])}`)
|
|
9324
|
+
.join(", ")
|
|
9325
|
+
} }`
|
|
9326
|
+
},
|
|
9327
|
+
enumerable: false, // mirrors the built-in Error.prototype.message, whose descriptor is also non-enumerable
|
|
9328
|
+
configurable: true
|
|
9329
|
+
})
|
|
9330
|
+
}
|
|
9331
|
+
|
|
9332
|
+
return TaggedErrorClass as any
|
|
9322
9333
|
}
|
|
9323
9334
|
|
|
9324
9335
|
const extendFields = (a: Struct.Fields, b: Struct.Fields): Struct.Fields => {
|
package/src/internal/version.ts
CHANGED