-
Notifications
You must be signed in to change notification settings - Fork 110
/
errors.ts
44 lines (41 loc) · 1.34 KB
/
errors.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { ParameterValidationError, UnsupportedActionError } from '@taquito/core';
export {
InvalidAddressError,
InvalidBlockHashError,
InvalidHexStringError,
InvalidMessageError,
InvalidKeyError,
InvalidPublicKeyError,
InvalidSignatureError,
InvalidContractAddressError,
InvalidChainIdError,
InvalidKeyHashError,
InvalidOperationHashError,
InvalidOperationKindError,
DeprecationError,
ProhibitedActionError,
} from '@taquito/core';
/**
* @category Error
* @description Error that indicates invalid protocol hash being passed or used
*/
export class InvalidProtocolHashError extends ParameterValidationError {
public name = 'InvalidProtocolHashError';
constructor(public readonly protocolHash: string, public readonly errorDetails?: string) {
super();
this.name = 'InvalidProtocolHashError';
this.message = `The protocol hash '${protocolHash}' is invalid`;
errorDetails ? (this.message += `: ${errorDetails}`) : null;
}
}
/**
* @category Error
* @description Error that indicates unable to convert data type from one to another
*/
export class ValueConversionError extends UnsupportedActionError {
constructor(public readonly value: string, public readonly desiredType: string) {
super();
this.name = 'ValueConversionError';
this.message = `Unable to convert ${value} to a ${desiredType}`;
}
}