(json: unknown)
| 119 | const cause = Schema.optional(Schema.Defect()) |
| 120 | |
| 121 | const withoutCause = (json: unknown): unknown => { |
| 122 | if (Predicate.isObject(json) && "cause" in json) { |
| 123 | const { cause: _, ...rest } = json as Record<string, unknown> |
| 124 | return rest |
| 125 | } |
| 126 | return json |
| 127 | } |
| 128 | |
| 129 | const reasonMessage = (reason: { readonly _tag: string; readonly detail?: string | undefined }): string => |
| 130 | reason.detail === undefined ? reason._tag : `${reason._tag}: ${reason.detail}` |