Skip to content

Commit

Permalink
fix(index): spelling and grammar in error messages (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs authored Jan 15, 2025
1 parent 76d2e3c commit 8376e94
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ class RefResolver {
if (sourceSchema[key] !== undefined) {
if (deepEqual(sourceSchema[key], targetSchema[key])) continue
throw new Error(
`Cannot resolve ref "${ref.ref}". Property "${key}" is already exist in schema "${ref.sourceSchemaId}".`
`Cannot resolve ref "${ref.ref}". Property "${key}" already exists in schema "${ref.sourceSchemaId}".`
)
}
sourceSchema[key] = targetSchema[key]
Expand All @@ -250,7 +250,7 @@ class RefResolver {
#insertSchemaByAnchor (schema, schemaId, anchor) {
const { anchors } = this.#schemas[schemaId]
if (anchors[anchor] !== undefined) {
throw new Error(`There is already another anchor "${anchor}" in a schema "${schemaId}".`)
throw new Error(`There is already another anchor "${anchor}" in schema "${schemaId}".`)
}
anchors[anchor] = schema
}
Expand Down
2 changes: 1 addition & 1 deletion test/collisions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,6 @@ test('should throw if there is the same anchor in the same schema', () => {
refResolver.addSchema(schema)
assert.fail('should throw')
} catch (err) {
assert.equal(err.message, 'There is already another anchor "#subSchemaId" in a schema "schemaId1".')
assert.equal(err.message, 'There is already another anchor "#subSchemaId" in schema "schemaId1".')
}
})
2 changes: 1 addition & 1 deletion test/deref-schema.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ test('should throw id source schema has a key with a same key as ref schema, but
} catch (err) {
assert.strictEqual(
err.message,
'Cannot resolve ref "schemaId2". Property "properties" is already exist in schema "schemaId1".'
'Cannot resolve ref "schemaId2". Property "properties" already exists in schema "schemaId1".'
)
}
})
Expand Down

0 comments on commit 8376e94

Please # to comment.