Skip to content

Commit

Permalink
fix(validation): only log error part of errror (w/o schema, value)
Browse files Browse the repository at this point in the history
  • Loading branch information
gadicc committed Sep 23, 2024
1 parent 1b09239 commit 859a0fb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/lib/validateAndCoerceTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,20 @@ import {
} from "@sinclair/typebox/value";
import { ValidationOptions } from "./options";

function logRelevantErrorInfo(
e: TransformDecodeError | TransformDecodeCheckError,
) {
const { /* schema, */ error /* , value */ } = e;
console.log(JSON.stringify(error, null, 2));
}

const handleResultError = (
e: TransformDecodeError | TransformDecodeCheckError,
options: ValidationOptions,
) => {
const title = e.schema.title;
if (options.logErrors) {
console.log(JSON.stringify(e, null, 2));
logRelevantErrorInfo(e);
console.log(`
This may happen intermittently and you should catch errors appropriately.
However: 1) if this recently started happening on every request for a symbol
Expand Down

0 comments on commit 859a0fb

Please sign in to comment.