Comparing version 3.0.2 to 3.0.3
@@ -16,11 +16,19 @@ import { getPrettify } from "./ajv-errors.js"; | ||
function makeExplanation(errors, { schema, data, colors = getSuretypeOptions().colors, location = getSuretypeOptions().location, bigNumbers = getSuretypeOptions().bigNumbers, noFallback = false }) { | ||
if (schema && typeof schema === 'object') | ||
return getPrettify()({ | ||
errors, | ||
schema, | ||
data, | ||
colors, | ||
location, | ||
bigNumbers, | ||
}); | ||
var _a; | ||
if (schema && typeof schema === 'object') { | ||
try { | ||
return getPrettify()({ | ||
errors, | ||
schema, | ||
data, | ||
colors, | ||
location, | ||
bigNumbers, | ||
}); | ||
} | ||
catch (err) { | ||
console.error(err === null || err === void 0 ? void 0 : err.stack); | ||
return (_a = err.message) !== null && _a !== void 0 ? _a : 'Unknown error'; | ||
} | ||
} | ||
else if (!noFallback) | ||
@@ -27,0 +35,0 @@ return JSON.stringify(errors, null, 2); |
{ | ||
"name": "suretype", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"description": "Typesafe JSON (Schema) validator with magic powers 🧙♂️", | ||
@@ -62,3 +62,3 @@ "author": "Gustaf Räntilä", | ||
"ajv": "^6.11.0", | ||
"awesome-ajv-errors": "^4.1.0", | ||
"awesome-ajv-errors": "^4.1.1", | ||
"meta-types": "^1.1.1" | ||
@@ -65,0 +65,0 @@ }, |
176287
4501
Updatedawesome-ajv-errors@^4.1.1