DEV Community

loading...

Discussion on: Custom exceptions with JS

Collapse
tieppt profile image
Tiep Phan

You don't need explicit call this line

class ValidationError extends Error {
  constructor(message) {
    super(message) // this one will store the message variable to message field
    this.name = 'VALIDATION_ERROR'
    // this.message = message
  }
}