Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. # es6-error
  2. [![npm version](https://badge.fury.io/js/es6-error.svg)](https://www.npmjs.com/package/es6-error)
  3. [![Build Status](https://travis-ci.org/bjyoungblood/es6-error.svg?branch=master)](https://travis-ci.org/bjyoungblood/es6-error)
  4. An easily-extendable error class for use with ES6 classes (or ES5, if you so
  5. choose).
  6. Tested in Node 4.0, Chrome, and Firefox.
  7. ## Why?
  8. I made this because I wanted to be able to extend Error for inheritance and type
  9. checking, but can never remember to add
  10. `Error.captureStackTrace(this, this.constructor.name)` to the constructor or how
  11. to get the proper name to print from `console.log`.
  12. ## ES6 Usage
  13. ```javascript
  14. import ExtendableError from 'es6-error';
  15. class MyError extends ExtendableError {
  16. // constructor is optional; you should omit it if you just want a custom error
  17. // type for inheritance and type checking
  18. constructor(message = 'Default message') {
  19. super(message);
  20. }
  21. }
  22. export default MyError;
  23. ```
  24. ## ES5 Usage
  25. ```javascript
  26. var util = require('util');
  27. var ExtendableError = require('es6-error');
  28. function MyError(message) {
  29. message = message || 'Default message';
  30. ExtendableError.call(this, message);
  31. }
  32. util.inherits(MyError, ExtendableError);
  33. module.exports = MyError;
  34. ```
  35. ### Known Issues
  36. - Uglification can obscure error class names ([#31](https://github.com/bjyoungblood/es6-error/issues/31#issuecomment-301128220))
  37. #### Todo
  38. - Better browser compatibility
  39. - Browser tests