Skip to content

Commit

Permalink
fix: better error for ajv blow up issue
Browse files Browse the repository at this point in the history
  • Loading branch information
shanejonas committed May 8, 2024
1 parent 851b3d8 commit 3691390
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/validate-open-rpc-document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,8 @@ export default function validateOpenRPCDocument(
delete metaSchemaCopy.$id;
try {
ajv.validate(metaSchemaCopy, document);
} catch (e) {
return new OpenRPCDocumentValidationError([
{
message: (e as unknown as Error).message,
dataPath: "unknown",
schemaPath: "unknown",
params: {},
keyword: "unknown",
data: JSON.parse(JSON.stringify(e)),
},
]);
} catch (e: any) {
return new Error(`schema-utils-js: Internal Error: ${e.message}\nIf you see this report it: https://github.com/open-rpc/schema-utils-js/issues`);
}

if (ajv.errors) {
Expand Down

0 comments on commit 3691390

Please sign in to comment.