es6-error

WebJar for es6-error

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

es6-error
Последняя версия

Последняя версия

4.1.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

es6-error
WebJar for es6-error
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/bjyoungblood/es6-error

Скачать es6-error

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/es6-error/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>es6-error</artifactId>
    <version>4.1.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/es6-error/
implementation 'org.webjars.npm:es6-error:4.1.1'
// https://jarcasting.com/artifacts/org.webjars.npm/es6-error/
implementation ("org.webjars.npm:es6-error:4.1.1")
'org.webjars.npm:es6-error:jar:4.1.1'
<dependency org="org.webjars.npm" name="es6-error" rev="4.1.1">
  <artifact name="es6-error" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='es6-error', version='4.1.1')
)
libraryDependencies += "org.webjars.npm" % "es6-error" % "4.1.1"
[org.webjars.npm/es6-error "4.1.1"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

es6-error

npm version Build Status

An easily-extendable error class for use with ES6 classes (or ES5, if you so choose).

Tested in Node 4.0, Chrome, and Firefox.

Why?

I made this because I wanted to be able to extend Error for inheritance and type checking, but can never remember to add Error.captureStackTrace(this, this.constructor.name) to the constructor or how to get the proper name to print from console.log.

ES6 Usage

import ExtendableError from 'es6-error';

class MyError extends ExtendableError {
  // constructor is optional; you should omit it if you just want a custom error
  // type for inheritance and type checking
  constructor(message = 'Default message') {
    super(message);
  }
}

export default MyError;

ES5 Usage

var util = require('util');
var ExtendableError = require('es6-error');

function MyError(message) {
  message = message || 'Default message';
  ExtendableError.call(this, message);
}

util.inherits(MyError, ExtendableError);

module.exports = MyError;

Known Issues

  • Uglification can obscure error class names (#31)

Todo

  • Better browser compatibility
  • Browser tests

Версии библиотеки

Версия
4.1.1
4.0.0
3.2.0