1.3.0 • Published 8 years ago

wp-error v1.3.0

Weekly downloads
1,496
License
MIT
Repository
github
Last release
8 years ago

wp-error

Common logic to process WordPress.com API responses into JS Error objects

Creates a JavaScript Error instance, with properties copied over from the given object, and HTTP response status interpreted.

Installation

Install wp-error using npm:

$ npm install --save wp-error

Examples

var err = new WPError({
  error: 'processing_failed',
  error_description: 'Invalid upload format',
);
err.toString();
// "ProcessingFailedError: Invalid upload format"

License

MIT – Copyright Automattic 2016