MCPcopy Create free account
hub / github.com/arktypeio/arktype / ArkIssues

Class ArkIssues

ark/aot/settingsValidators.ts:210–268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

208 }
209 }
210 : class ArkIssues {
211 constructor() {
212 this._ = []
213 this._p = []
214 }
215 get count() {
216 return this._.length
217 }
218 get issues() {
219 return serializableIssues(this._)
220 }
221 _e(data, code, expected, message, text) {
222 this._.push({ code, path: this._p.slice(), data, expected, message })
223 if (callsSiteText) text?.(this._[this._.length - 1])
224 return void 0
225 }
226 _k(apply, data, key, ...missing) {
227 this._p.push(key)
228 const stops2 =
229 missing.length && !(key in data) ?
230 this._e(data, "required", ...missing)
231 : !apply(data[key], this)
232 this._p.pop()
233 return stops2
234 }
235 get summary() {
236 let summary = ""
237 for (const issue of this._)
238 summary += (summary && "\n") + issueLineOf(issue)
239 return summary
240 }
241 summaryIn(locale) {
242 refuseLocale(locale)
243 return this.summary
244 }
245 // constructed by TraversalError wherever its bundle keeps the
246 // class: otherwise an Error with the same name, message and
247 // errors, and no class in its bundle. Its name is assigned and
248 // its errors defined as the class's are, in statements, which
249 // gzip to less than one expression building it and which a build
250 // writing the flag as a literal folds as well
251 throw() {
252 if (namesTraversalError) throw new ThrownIssues(this)
253 if (mayDefineTraversalError && definedThrown)
254 throw new definedThrown(this)
255 const thrown = Error(this.summary)
256 thrown.name = "TraversalError"
257 throw Object.defineProperty(thrown, "arkErrors", { value: this })
258 }
259 toJSON() {
260 return this.issues.map(jsonIssueOf)
261 }
262 [Symbol.iterator]() {
263 return this.issues[Symbol.iterator]()
264 }
265 toString() {
266 return this.summary
267 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected