MCPcopy Create free account
hub / github.com/Effect-TS/effect / BrandError

Class BrandError

packages/effect/src/Brand.ts:110–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108 * @since 4.0.0
109 */
110export 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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected