()
| 86 | } |
| 87 | |
| 88 | override toJSON(): unknown { |
| 89 | const json = super.toJSON() as Record<string, unknown> |
| 90 | // A copy of the reason's cause, which `InvalidUrlError` keeps out of its JSON. |
| 91 | if (this.reason._tag === "InvalidUrlError") delete json.cause |
| 92 | return json |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | const formatReason = (tag: string) => tag.endsWith("Error") ? tag.slice(0, -5) : tag |