From c012cc4c9fb5f7952845b216e241d4c14ce3c4d0 Mon Sep 17 00:00:00 2001 From: Gadi Cohen Date: Wed, 3 Feb 2021 10:49:54 +0200 Subject: [PATCH] chore(validate): better explanation --- src/lib/validateAndCoerceTypes.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/lib/validateAndCoerceTypes.ts b/src/lib/validateAndCoerceTypes.ts index c8f330b7..e28f6e05 100644 --- a/src/lib/validateAndCoerceTypes.ts +++ b/src/lib/validateAndCoerceTypes.ts @@ -84,15 +84,18 @@ function validate(object: object, key: string, module?: string): void { console.error("The following result did not validate with schema: " + key); logObj(validator.errors); logObj(object); - console.error("You should handle occassional errors in your code, however if "); - console.error("this happens every time, probably Yahoo have changed their API "); - console.error("and node-yahoo-finance2 needs to be updated. Please see if "); - console.error("anyone has reported this previously:"); - console.error(); + console.error(` +This may happen intermittently and you should catch errors appropriately. +However: 1) if this recently started happening on every request for a symbol +that used to work, Yahoo may have changed their API. 2) If this happens on +every request for a symbol you've never used before, but not for other +symbols, you've found an edge-case. Please see if anyone has reported +this previously: +`) console.error(` ${pkg.repository}/issues?q=is%3Aissue+${title}`); - console.error(); - console.error("or open a new issue:"); - console.error(); + console.error(""); + console.error("or open a new issue (and mention the symbol):"); + console.error(""); console.error(` ${pkg.repository}/issues/new?title=${title}`); throw new FailedYahooValidationError("Failed Yahoo Schema validation");