| 108 | * @since 4.0.0 |
| 109 | */ |
| 110 | export class BrandError { |
| 111 | constructor(issue: SchemaIssue.Issue) { |
| 112 | this.issue = issue |
| 113 | } |
| 114 | /** |
| 115 | * Discriminant used to identify brand construction failures. |
| 116 | * |
| 117 | * @since 4.0.0 |
| 118 | */ |
| 119 | readonly _tag = "BrandError" |
| 120 | /** |
| 121 | * Error name used by tools that inspect JavaScript error-like objects. |
| 122 | * |
| 123 | * @since 4.0.0 |
| 124 | */ |
| 125 | readonly name: string = "BrandError" |
| 126 | /** |
| 127 | * Schema issue describing why brand validation failed. |
| 128 | * |
| 129 | * @since 4.0.0 |
| 130 | */ |
| 131 | readonly issue: SchemaIssue.Issue |
| 132 | /** |
| 133 | * Human-readable rendering of the validation issue. |
| 134 | * |
| 135 | * @since 4.0.0 |
| 136 | */ |
| 137 | get message() { |
| 138 | return SchemaIssue.defaultFormatter(this.issue) |
| 139 | } |
| 140 | /** |
| 141 | * Formats the brand error together with its validation message. |
| 142 | * |
| 143 | * @since 4.0.0 |
| 144 | */ |
| 145 | toString() { |
| 146 | return `BrandError(${this.message})` |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | /** |
| 151 | * Namespace containing type-level helpers for working with branded types and |
nothing calls this directly
no outgoing calls
no test coverage detected