From acec6101b0742f522d90bc377926b31127ef87da Mon Sep 17 00:00:00 2001 From: calvintwr Date: Wed, 8 Sep 2021 00:24:01 +0800 Subject: [PATCH 1/2] Update readme.md --- readme.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/readme.md b/readme.md index f62bf1a..b305eef 100644 --- a/readme.md +++ b/readme.md @@ -67,7 +67,7 @@ let sanitised = Not.scrub( payload ) ``` -**API error resNot throws an actionable error message:** +**Not throws an actionable error message ready for sending back to the requestor:** ``` TypeError (NotTS): Wrong types provided. See `trace`. ... stack trace ... @@ -83,13 +83,13 @@ If you are using express or fastify, thrown errors can be seamlessly used for pr //express res.status(sanitised.statusCode) res.send({ - message: `You have provided erroneous inputs. \n\nMore info:\n${sanitised.track.join('\n')}` + message: `You have provided erroneous inputs. \n\nMore info:\n${sanitised.trace.join('\n')}` }) //fastify reply.code(sanitised.statusCode) reply.send({ - message: `You have provided erroneous inputs. \n\nMore info:\n${sanitised.track.join('\n')}` + message: `You have provided erroneous inputs. \n\nMore info:\n${sanitised.trace.join('\n')}` }) ``` This will produce a `400` error with the follow `message` property in response body: From e0f3c75b997bd0ab2acbe586ef6d423513620c7e Mon Sep 17 00:00:00 2001 From: calvintwr Date: Wed, 8 Sep 2021 00:25:24 +0800 Subject: [PATCH 2/2] Update readme.md --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index b305eef..d36bea3 100644 --- a/readme.md +++ b/readme.md @@ -135,7 +135,7 @@ const is = Not.createIs() const notNerfed = Not.create({ throw: false }) // creates an instance that will not throw errors. ``` -Use *Not* to cuts down runtime type-checking verbiage. Instead of: +Use *Not* to cut down runtime type-checking verbiage. Instead of: ```js if (typeof foo !== 'string' ||