From ff7cf33b8cb7339a4141e6ec6d5913e3ec923821 Mon Sep 17 00:00:00 2001 From: codingwithmanny Date: Mon, 2 Jan 2023 23:32:32 +0300 Subject: [PATCH] docs: Adjusted try/catch Removed try catch in favour of result because it doesn't throw an error BREAKING CHANGE: N --- src/validate-open-rpc-document.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/validate-open-rpc-document.ts b/src/validate-open-rpc-document.ts index 2ef65d17..7a31d911 100644 --- a/src/validate-open-rpc-document.ts +++ b/src/validate-open-rpc-document.ts @@ -37,15 +37,11 @@ export class OpenRPCDocumentValidationError implements Error { * * import { validateOpenRPCDocument } from "@open-rpc/schema-utils-js"; * const badOpenRPCDocument = {} as any; - * try { - * const isValid = validateOpenRPCDocument(badOpenRPCDocument); - * if (isValid) { - * // handle validity - * } - * } catch (error) { - * // handle error + * + * const result = validateOpenRPCDocument(badOpenRPCDocument); + * if (result !== true) { + * console.error({ error: result }) * } - * ``` * */