Skip to content

Error inheritance is troublesome #239

@myndzi

Description

@myndzi

Joi inherits from the Error object and returns this, thus passing an instanceof check, but the returned object does not appear to behave like an Error proper. This might be some internal stuff in V8, I don't know.

Most significantly, there is no stack trace attached. It would be super nice if, instead of using util.inherits() and Error.call(), Joi instead created an actual Error object and attached its properties to it. This would return an Error object with a .stack property and all the rest without producing a nonconformant Error object.

Metadata

Metadata

Assignees

Labels

breaking changesChange that can breaking existing codebugBug or defect

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions