source: trip-planner-front/node_modules/sshpk/lib/errors.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

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