You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If `fastify-error` is installed multiple times as direct and/or transitive dependency, it is ensured that Errors created with `createError` are working with the `instanceof` operator correctly cross the `fastify-error` installation, as long the code, e.g. `FST_ERR_CUSTOM_ERROR`, is the same.
Copy file name to clipboardExpand all lines: test/instanceof.test.js
+49Lines changed: 49 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,55 @@ const os = require('node:os')
7
7
consttest=require('node:test')
8
8
const{ createError, FastifyError }=require('..')
9
9
10
+
test('Readme: All errors created with `createError` will be instances of the base error constructor you provided, or `Error` if none was provided.',(t)=>{
test('Readme: All instantiated errors will be instances of the `FastifyError` class. The `FastifyError` class can be required from the module directly.',(t)=>{
test('Readme: It is possible to create a `FastifyError` that extends another `FastifyError`, created by `createError`, while instanceof working correctly.',(t)=>{
0 commit comments