Badly implemented Boom like class can cause runtime error
- Dominant language
- JavaScript
- Stars
- 2.9k
- Forks
- 191
- PR merge metrics
- No merged PRs in 30d
Description
### Runtime
na
### Runtime version
na
### Module version
all
### Last module version without issue
?
### Used with
standalone
### Any other relevant information
_No response_
### What are you trying to achieve or the steps to reproduce?
```js
const BadBoom = class extends Error { isBoom = true; };
Boom.isBoom(new BadBoom()); // true
Boom.isBoom(new BadBoom(), 404); // Cannot read properties of undefined (reading 'statusCode')
```
### What was the result you got?
An error because `err.output` is undefined in the `BadBoom` instance
### What result did you expect?
I know that `isBoom` is meant to work with object created only with any version of the `@hapi/boom` package but it could at least ensure that `err.output` is an object and that `err.output.statusCode` is a number.
What do you think ?
Contributor guide
Assessment
This issue has not been assessed yet.