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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # serialize-error [![Build Status](https://travis-ci.org/sindresorhus/serialize-error.svg?branch=master)](https://travis-ci.org/sindresorhus/serialize-error)
  2. > Serialize/deserialize an error into a plain object
  3. Useful if you for example need to `JSON.stringify()` or `process.send()` the error.
  4. ## Install
  5. ```
  6. $ npm install serialize-error
  7. ```
  8. ## Usage
  9. ```js
  10. const {serializeError, deserializeError} = require('serialize-error');
  11. const error = new Error('🦄');
  12. console.log(error);
  13. //=> [Error: 🦄]
  14. const serialized = serializeError(error)
  15. console.log(serialized);
  16. //=> {name: 'Error', message: '🦄', stack: 'Error: 🦄\n at Object.<anonymous> …'}
  17. const deserialized = deserializeError(serialized);
  18. //=> [Error: 🦄]
  19. ```
  20. ## API
  21. ### serializeError(value)
  22. Type: `Error | unknown`
  23. Serialize an `Error` object into a plain object.
  24. Non-error values are passed through.
  25. Custom properties are preserved.
  26. Non-enumerable properties are kept non-enumerable (name, message, stack).
  27. Enumerable properties are kept enumerable (all properties besides the non-enumerable ones).
  28. Circular references are handled.
  29. ### deserializeError(value)
  30. Type: `{[key: string]: unknown} | unknown`
  31. Deserialize a plain object or any value into an `Error` object.
  32. `Error` objects are passed through.
  33. Non-error values are wrapped in a `NonError` error.
  34. Custom properties are preserved.
  35. Circular references are handled.