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.

errors.js 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. // Copyright 2015 Joyent, Inc.
  2. var assert = require('assert-plus');
  3. var util = require('util');
  4. function FingerprintFormatError(fp, format) {
  5. if (Error.captureStackTrace)
  6. Error.captureStackTrace(this, FingerprintFormatError);
  7. this.name = 'FingerprintFormatError';
  8. this.fingerprint = fp;
  9. this.format = format;
  10. this.message = 'Fingerprint format is not supported, or is invalid: ';
  11. if (fp !== undefined)
  12. this.message += ' fingerprint = ' + fp;
  13. if (format !== undefined)
  14. this.message += ' format = ' + format;
  15. }
  16. util.inherits(FingerprintFormatError, Error);
  17. function InvalidAlgorithmError(alg) {
  18. if (Error.captureStackTrace)
  19. Error.captureStackTrace(this, InvalidAlgorithmError);
  20. this.name = 'InvalidAlgorithmError';
  21. this.algorithm = alg;
  22. this.message = 'Algorithm "' + alg + '" is not supported';
  23. }
  24. util.inherits(InvalidAlgorithmError, Error);
  25. function KeyParseError(name, format, innerErr) {
  26. if (Error.captureStackTrace)
  27. Error.captureStackTrace(this, KeyParseError);
  28. this.name = 'KeyParseError';
  29. this.format = format;
  30. this.keyName = name;
  31. this.innerErr = innerErr;
  32. this.message = 'Failed to parse ' + name + ' as a valid ' + format +
  33. ' format key: ' + innerErr.message;
  34. }
  35. util.inherits(KeyParseError, Error);
  36. function SignatureParseError(type, format, innerErr) {
  37. if (Error.captureStackTrace)
  38. Error.captureStackTrace(this, SignatureParseError);
  39. this.name = 'SignatureParseError';
  40. this.type = type;
  41. this.format = format;
  42. this.innerErr = innerErr;
  43. this.message = 'Failed to parse the given data as a ' + type +
  44. ' signature in ' + format + ' format: ' + innerErr.message;
  45. }
  46. util.inherits(SignatureParseError, Error);
  47. function CertificateParseError(name, format, innerErr) {
  48. if (Error.captureStackTrace)
  49. Error.captureStackTrace(this, CertificateParseError);
  50. this.name = 'CertificateParseError';
  51. this.format = format;
  52. this.certName = name;
  53. this.innerErr = innerErr;
  54. this.message = 'Failed to parse ' + name + ' as a valid ' + format +
  55. ' format certificate: ' + innerErr.message;
  56. }
  57. util.inherits(CertificateParseError, Error);
  58. function KeyEncryptedError(name, format) {
  59. if (Error.captureStackTrace)
  60. Error.captureStackTrace(this, KeyEncryptedError);
  61. this.name = 'KeyEncryptedError';
  62. this.format = format;
  63. this.keyName = name;
  64. this.message = 'The ' + format + ' format key ' + name + ' is ' +
  65. 'encrypted (password-protected), and no passphrase was ' +
  66. 'provided in `options`';
  67. }
  68. util.inherits(KeyEncryptedError, Error);
  69. module.exports = {
  70. FingerprintFormatError: FingerprintFormatError,
  71. InvalidAlgorithmError: InvalidAlgorithmError,
  72. KeyParseError: KeyParseError,
  73. SignatureParseError: SignatureParseError,
  74. KeyEncryptedError: KeyEncryptedError,
  75. CertificateParseError: CertificateParseError
  76. };