Skip to content

Commit f3897c9

Browse files
committed
feat: Improve schema errors for human readability
1 parent 42decf6 commit f3897c9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/schemas/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ const validateGithubOrg = (data) => {
99
const validate = ajv.compile(githubOrganizationSchema)
1010
const valid = validate(data)
1111
if (!valid) {
12-
throw new Error(validate.errors.map((error) => error.message).join('\n'))
12+
const readableErrors = validate.errors.map((error) => `[ERROR: ${error.keyword}]${error.schemaPath}: ${error.message}`).join('\n')
13+
throw new Error(`Error when validating the Github org response from API: ${readableErrors}`)
1314
}
1415
return null
1516
}

0 commit comments

Comments
 (0)