Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
Don't subclass legacy errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdalton committed Aug 13, 2018
1 parent 809d887 commit 399e503
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ function init() {
}

function createLegacyErrorClass(Super, code) {
return class LegacyError extends Super {
constructor(...args) {
super(messages[code](...args))
this.code = code
}
return function LegacyError(...args) {
const error = new Super(messages[code](...args))

error.code = code
return error
}
}

Expand Down

0 comments on commit 399e503

Please sign in to comment.