Skip to content

Latest commit

 

History

History
13 lines (10 loc) · 366 Bytes

error-handling.md

File metadata and controls

13 lines (10 loc) · 366 Bytes

Error Handling

  • Errors only accept strings as an argument
  • If we want to get fancy we can either make an object and then stringify the message, or use ES6 Custom Errors

Example

x = new Error('404 not found')
console.log(x) // Error: 404 not found

y = new Error({type: '404', message: 'not found'})
console.log(y) // Error: [object Object]