wp-error

1.3.0 • Public • Published

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.3.0
    11,804
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.3.0
    11,804
  • 1.2.0
    2
  • 1.1.0
    3
  • 1.0.0
    1

Package Sidebar

Install

npm i wp-error

Weekly Downloads

8,638

Version

1.3.0

License

MIT

Last publish

Collaborators

  • tootallnate