JSPM

  • Created
  • Published
  • Downloads 2230676
  • Score
    100M100P100Q173441F

Custom errors

Package Exports

  • error/typed
  • error/validation

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (error) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

error

Custom errors

Example

var ValidationError = require("error/validation")
var OptionError = require("error/option")

var error = ValidationError([{
  message: "Please enter required field",
  attribute: "name"
}, {
  message: "Password must be at least 10 characters",
  attribute: "password"
}])

console.log("error.errors", error.errors)

var error = OptionError("Something went wrong", metaData)

console.log("error.option", error.option)

Installation

npm install error

Contributors

  • Raynos

MIT Licenced