Skip to content

Commit 4985a36

Browse files
committed
remove unnecessary includes check from ctx.error
1 parent 6758030 commit 4985a36

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

ark/schema/shared/errors.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ export class ArkErrors
224224
add(error: ArkError): void {
225225
const existing = this.byPath[error.propString]
226226
if (existing) {
227+
// only add if it's not already in the errors collection
227228
if (error === existing) return
228229
// If the existing error is an error for a value constrained to "never",
229230
// then we don't want to intersect the error messages.

ark/schema/shared/traversal.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,7 @@ export class Traversal {
257257

258258
if (result instanceof ArkError) {
259259
// if an ArkError was returned, ensure it has been added to errors
260-
// (it may have already been added via ctx.error() within the morph)
261-
// Only add if it's not already in the errors collection
262-
if (!this.errors.includes(result)) this.errors.add(result)
260+
this.errors.add(result)
263261

264262
// skip any remaining morphs at the current path
265263
break

0 commit comments

Comments
 (0)