HydrawiseCommandException.js 501 B

123456789101112131415161718192021
  1. 'use strict';
  2. /**
  3. * @author Martijn Dierckx
  4. */
  5. /** Class representing a specifc error triggered by the Hydrawise API binding */
  6. class HydrawiseCommandException extends Error {
  7. constructor(message, ...params) {
  8. super(...params);
  9. Error.captureStackTrace(this, HydrawiseCommandException);
  10. this.name = 'HydrawiseCommandException';
  11. this.message = message;
  12. this.date = new Date();
  13. }
  14. }
  15. module.exports = (message, ...params) => {
  16. return new HydrawiseCommandException(message, ...params);
  17. };