Skip to content

Instantly share code, notes, and snippets.

@lakamsani
Created August 30, 2018 05:53
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lakamsani/46f53df86b9d046c93946a281725e305 to your computer and use it in GitHub Desktop.
Save lakamsani/46f53df86b9d046c93946a281725e305 to your computer and use it in GitHub Desktop.

Hi, looks like this code fragment from your blog at: https://rclayton.silvrback.com/custom-errors-in-node-js

// I do something like this to wrap errors from other frameworks.
class InternalError extends DomainError {
  super(error.message);
  this.data = { error };
}

should be modified to have a constructor that takes that error from other frameworks like this?

// I do something like this to wrap errors from other frameworks.
class InternalError extends DomainError {
  constructor(error) {
    super(error.message);
    this.data = { error };
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment