@libp2p/interface 1.7.0-df330695a → 1.7.0-e1ca9cced
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.min.js +1 -1
- package/dist/src/errors.d.ts +116 -14
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/errors.js +119 -24
- package/dist/src/errors.js.map +1 -1
- package/package.json +1 -1
- package/src/errors.ts +150 -35
package/dist/index.min.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PInterface = factory()}(typeof self !== 'undefined' ? self : this, function () {
|
|
2
|
-
"use strict";var Libp2PInterface=(()=>{var n=Object.defineProperty;var
|
|
2
|
+
"use strict";var Libp2PInterface=(()=>{var n=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var J=Object.getOwnPropertyNames;var Q=Object.prototype.hasOwnProperty;var V=(t,r)=>{for(var e in r)n(t,e,{get:r[e],enumerable:!0})},W=(t,r,e,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of J(r))!Q.call(t,o)&&o!==e&&n(t,o,{get:()=>r[o],enumerable:!(s=H(r,o))||s.enumerable});return t};var X=t=>W(n({},"__esModule",{value:!0}),t);var lr={};V(lr,{AbortError:()=>c,AlreadyStartedError:()=>D,ConnectionClosedError:()=>E,ConnectionClosingError:()=>f,ConnectionFailedError:()=>h,DialError:()=>N,FaultTolerance:()=>i,InvalidCIDError:()=>L,InvalidCryptoExchangeError:()=>l,InvalidMessageError:()=>A,InvalidMultiaddrError:()=>g,InvalidMultihashError:()=>P,InvalidParametersError:()=>m,InvalidPeerIdError:()=>I,InvalidPrivateKeyError:()=>x,InvalidPublicKeyError:()=>u,KEEP_ALIVE:()=>er,LimitedConnectionError:()=>k,ListenError:()=>U,MuxerClosedError:()=>b,NotFoundError:()=>v,NotStartedError:()=>M,ProtocolError:()=>C,StreamResetError:()=>y,StreamStateError:()=>S,StrictNoSign:()=>sr,StrictSign:()=>or,TimeoutError:()=>T,TooManyInboundProtocolStreamsError:()=>_,TooManyOutboundProtocolStreamsError:()=>F,TopicValidatorResult:()=>a,TypedEventEmitter:()=>B,UnexpectedPeerError:()=>p,UnsupportedKeyTypeError:()=>K,UnsupportedOperationError:()=>d,UnsupportedProtocolError:()=>w,connectionSymbol:()=>j,contentRoutingSymbol:()=>Z,isConnection:()=>Y,isPeerId:()=>rr,isStartable:()=>R,isTransport:()=>nr,peerDiscoverySymbol:()=>$,peerIdSymbol:()=>q,peerRoutingSymbol:()=>tr,serviceCapabilities:()=>cr,serviceDependencies:()=>pr,setMaxListeners:()=>O,start:()=>ar,stop:()=>ir,transportSymbol:()=>z});var j=Symbol.for("@libp2p/connection");function Y(t){return t!=null&&!!t[j]}var Z=Symbol.for("@libp2p/content-routing");var $=Symbol.for("@libp2p/peer-discovery");var q=Symbol.for("@libp2p/peer-id");function rr(t){return!!t?.[q]}var tr=Symbol.for("@libp2p/peer-routing");var er="keep-alive";var or="StrictSign",sr="StrictNoSign",a;(function(t){t.Accept="accept",t.Ignore="ignore",t.Reject="reject"})(a||(a={}));var z=Symbol.for("@libp2p/transport");function nr(t){return t!=null&&!!t[z]}var i;(function(t){t[t.FATAL_ALL=0]="FATAL_ALL",t[t.NO_FATAL=1]="NO_FATAL"})(i||(i={}));var c=class extends Error{static name="AbortError";constructor(r="The operation was aborted"){super(r),this.name="AbortError"}},p=class extends Error{static name="UnexpectedPeerError";constructor(r="Unexpected Peer"){super(r),this.name="UnexpectedPeerError"}},l=class extends Error{static name="InvalidCryptoExchangeError";constructor(r="Invalid crypto exchange"){super(r),this.name="InvalidCryptoExchangeError"}},m=class extends Error{static name="InvalidParametersError";constructor(r="Invalid parameters"){super(r),this.name="InvalidParametersError"}},u=class extends Error{static name="InvalidPublicKeyError";constructor(r="Invalid public key"){super(r),this.name="InvalidPublicKeyError"}},x=class extends Error{static name="InvalidPrivateKeyError";constructor(r="Invalid private key"){super(r),this.name="InvalidPrivateKeyError"}},d=class extends Error{static name="UnsupportedOperationError";constructor(r="Unsupported operation"){super(r),this.name="UnsupportedOperationError"}},f=class extends Error{static name="ConnectionClosingError";constructor(r="The connection is closing"){super(r),this.name="ConnectionClosingError"}},E=class extends Error{static name="ConnectionClosedError";constructor(r="The connection is closed"){super(r),this.name="ConnectionClosedError"}},h=class extends Error{static name="ConnectionFailedError";constructor(r="Connection failed"){super(r),this.name="ConnectionFailedError"}},b=class extends Error{static name="MuxerClosedError";constructor(r="The muxer is closed"){super(r),this.name="MuxerClosedError"}},y=class extends Error{static name="StreamResetError";constructor(r="The stream has been reset"){super(r),this.name="StreamResetError"}},S=class extends Error{static name="StreamStateError";constructor(r="The stream is in an invalid state"){super(r),this.name="StreamStateError"}},v=class extends Error{static name="NotFoundError";constructor(r="Not found"){super(r),this.name="NotFoundError"}},I=class extends Error{static name="InvalidPeerIdError";constructor(r="Invalid PeerID"){super(r),this.name="InvalidPeerIdError"}},g=class extends Error{static name="InvalidMultiaddrError";constructor(r="Invalid multiaddr"){super(r),this.name="InvalidMultiaddrError"}},L=class extends Error{static name="InvalidCIDError";constructor(r="Invalid CID"){super(r),this.name="InvalidCIDError"}},P=class extends Error{static name="InvalidMultihashError";constructor(r="Invalid Multihash"){super(r),this.name="InvalidMultihashError"}},w=class extends Error{static name="UnsupportedProtocolError";constructor(r="Unsupported protocol error"){super(r),this.name="UnsupportedProtocolError"}},A=class extends Error{static name="InvalidMessageError";constructor(r="Invalid message"){super(r),this.name="InvalidMessageError"}},C=class extends Error{static name="ProtocolError";constructor(r="Protocol error"){super(r),this.name="ProtocolError"}},T=class extends Error{static name="TimeoutError";constructor(r="Timed out"){super(r),this.name="TimeoutError"}},M=class extends Error{static name="NotStartedError";constructor(r="Not started"){super(r),this.name="NotStartedError"}},D=class extends Error{static name="AlreadyStartedError";constructor(r="Already started"){super(r),this.name="AlreadyStartedError"}},N=class extends Error{static name="DialError";constructor(r="Dial error"){super(r),this.name="DialError"}},U=class extends Error{static name="ListenError";constructor(r="Listen error"){super(r),this.name="ListenError"}},k=class extends Error{static name="LimitedConnectionError";constructor(r="Limited connection"){super(r),this.name="LimitedConnectionError"}},_=class extends Error{static name="TooManyInboundProtocolStreamsError";constructor(r="Too many inbound protocol streams"){super(r),this.name="TooManyInboundProtocolStreamsError"}},F=class extends Error{static name="TooManyOutboundProtocolStreamsError";constructor(r="Too many outbound protocol streams"){super(r),this.name="TooManyOutboundProtocolStreamsError"}},K=class extends Error{static name="UnsupportedKeyTypeError";constructor(r="Unsupported key type"){super(r),this.name="UnsupportedKeyTypeError"}};var O=(t,...r)=>{try{[...r]}catch{}};var B=class extends EventTarget{#r=new Map;constructor(){super(),O(1/0,this)}listenerCount(r){let e=this.#r.get(r);return e==null?0:e.length}addEventListener(r,e,s){super.addEventListener(r,e,s);let o=this.#r.get(r);o==null&&(o=[],this.#r.set(r,o)),o.push({callback:e,once:(s!==!0&&s!==!1&&s?.once)??!1})}removeEventListener(r,e,s){super.removeEventListener(r.toString(),e??null,s);let o=this.#r.get(r);o!=null&&(o=o.filter(({callback:G})=>G!==e),this.#r.set(r,o))}dispatchEvent(r){let e=super.dispatchEvent(r),s=this.#r.get(r.type);return s==null||(s=s.filter(({once:o})=>!o),this.#r.set(r.type,s)),e}safeDispatchEvent(r,e={}){return this.dispatchEvent(new CustomEvent(r,e))}};function R(t){return t!=null&&typeof t.start=="function"&&typeof t.stop=="function"}async function ar(...t){let r=[];for(let e of t)R(e)&&r.push(e);await Promise.all(r.map(async e=>{e.beforeStart!=null&&await e.beforeStart()})),await Promise.all(r.map(async e=>{await e.start()})),await Promise.all(r.map(async e=>{e.afterStart!=null&&await e.afterStart()}))}async function ir(...t){let r=[];for(let e of t)R(e)&&r.push(e);await Promise.all(r.map(async e=>{e.beforeStop!=null&&await e.beforeStop()})),await Promise.all(r.map(async e=>{await e.stop()})),await Promise.all(r.map(async e=>{e.afterStop!=null&&await e.afterStop()}))}var cr=Symbol.for("@libp2p/service-capabilities"),pr=Symbol.for("@libp2p/service-dependencies");return X(lr);})();
|
|
3
3
|
return Libp2PInterface}));
|
package/dist/src/errors.d.ts
CHANGED
|
@@ -4,112 +4,214 @@
|
|
|
4
4
|
* AbortSignal.
|
|
5
5
|
*/
|
|
6
6
|
export declare class AbortError extends Error {
|
|
7
|
+
static name: string;
|
|
7
8
|
constructor(message?: string);
|
|
8
9
|
}
|
|
9
10
|
/**
|
|
10
|
-
*
|
|
11
|
+
* Thrown when a remote Peer ID does not match the expected one
|
|
11
12
|
*/
|
|
12
|
-
export declare class CodeError<T extends Record<string, any> = Record<string, never>> extends Error {
|
|
13
|
-
readonly code: string;
|
|
14
|
-
readonly props: T;
|
|
15
|
-
constructor(message: string, code: string, props?: T);
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* @deprecated
|
|
19
|
-
*/
|
|
20
|
-
export declare class AggregateCodeError<T extends Record<string, any> = Record<string, never>> extends AggregateError {
|
|
21
|
-
readonly code: string;
|
|
22
|
-
readonly props: T;
|
|
23
|
-
constructor(errors: Error[], message: string, code: string, props?: T);
|
|
24
|
-
}
|
|
25
13
|
export declare class UnexpectedPeerError extends Error {
|
|
14
|
+
static name: string;
|
|
26
15
|
constructor(message?: string);
|
|
27
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Thrown when a crypto exchange fails
|
|
19
|
+
*/
|
|
28
20
|
export declare class InvalidCryptoExchangeError extends Error {
|
|
21
|
+
static name: string;
|
|
29
22
|
constructor(message?: string);
|
|
30
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Thrown when invalid parameters are passed to a function or method call
|
|
26
|
+
*/
|
|
31
27
|
export declare class InvalidParametersError extends Error {
|
|
28
|
+
static name: string;
|
|
32
29
|
constructor(message?: string);
|
|
33
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Thrown when a public key is invalid
|
|
33
|
+
*/
|
|
34
34
|
export declare class InvalidPublicKeyError extends Error {
|
|
35
|
+
static name: string;
|
|
35
36
|
constructor(message?: string);
|
|
36
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Thrown when a private key is invalid
|
|
40
|
+
*/
|
|
37
41
|
export declare class InvalidPrivateKeyError extends Error {
|
|
42
|
+
static name: string;
|
|
38
43
|
constructor(message?: string);
|
|
39
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Thrown when a operation is unsupported
|
|
47
|
+
*/
|
|
40
48
|
export declare class UnsupportedOperationError extends Error {
|
|
49
|
+
static name: string;
|
|
41
50
|
constructor(message?: string);
|
|
42
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Thrown when a connection is closing
|
|
54
|
+
*/
|
|
43
55
|
export declare class ConnectionClosingError extends Error {
|
|
56
|
+
static name: string;
|
|
44
57
|
constructor(message?: string);
|
|
45
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Thrown when a connection is closed
|
|
61
|
+
*/
|
|
46
62
|
export declare class ConnectionClosedError extends Error {
|
|
63
|
+
static name: string;
|
|
47
64
|
constructor(message?: string);
|
|
48
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Thrown when a connection fails
|
|
68
|
+
*/
|
|
49
69
|
export declare class ConnectionFailedError extends Error {
|
|
70
|
+
static name: string;
|
|
71
|
+
constructor(message?: string);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Thrown when the muxer is closed and an attempt to open a stream occurs
|
|
75
|
+
*/
|
|
76
|
+
export declare class MuxerClosedError extends Error {
|
|
77
|
+
static name: string;
|
|
50
78
|
constructor(message?: string);
|
|
51
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* Thrown when a protocol stream is reset by the remote muxer
|
|
82
|
+
*/
|
|
52
83
|
export declare class StreamResetError extends Error {
|
|
84
|
+
static name: string;
|
|
53
85
|
constructor(message?: string);
|
|
54
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Thrown when a stream is in an invalid state
|
|
89
|
+
*/
|
|
55
90
|
export declare class StreamStateError extends Error {
|
|
91
|
+
static name: string;
|
|
56
92
|
constructor(message?: string);
|
|
57
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Thrown when a value could not be found
|
|
96
|
+
*/
|
|
58
97
|
export declare class NotFoundError extends Error {
|
|
98
|
+
static name: string;
|
|
59
99
|
constructor(message?: string);
|
|
60
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* Thrown when an invalid peer ID is encountered
|
|
103
|
+
*/
|
|
61
104
|
export declare class InvalidPeerIdError extends Error {
|
|
105
|
+
static name: string;
|
|
62
106
|
constructor(message?: string);
|
|
63
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* Thrown when an invalid multiaddr is encountered
|
|
110
|
+
*/
|
|
64
111
|
export declare class InvalidMultiaddrError extends Error {
|
|
112
|
+
static name: string;
|
|
65
113
|
constructor(message?: string);
|
|
66
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* Thrown when an invalid CID is encountered
|
|
117
|
+
*/
|
|
67
118
|
export declare class InvalidCIDError extends Error {
|
|
119
|
+
static name: string;
|
|
68
120
|
constructor(message?: string);
|
|
69
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* Thrown when an invalid multihash is encountered
|
|
124
|
+
*/
|
|
70
125
|
export declare class InvalidMultihashError extends Error {
|
|
126
|
+
static name: string;
|
|
71
127
|
constructor(message?: string);
|
|
72
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* Thrown when a protocol is not supported
|
|
131
|
+
*/
|
|
73
132
|
export declare class UnsupportedProtocolError extends Error {
|
|
133
|
+
static name: string;
|
|
74
134
|
constructor(message?: string);
|
|
75
135
|
}
|
|
76
136
|
/**
|
|
77
137
|
* An invalid or malformed message was encountered during a protocol exchange
|
|
78
138
|
*/
|
|
79
139
|
export declare class InvalidMessageError extends Error {
|
|
140
|
+
static name: string;
|
|
80
141
|
constructor(message?: string);
|
|
81
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* Thrown when a remote peer sends a structurally valid message that does not
|
|
145
|
+
* comply with the protocol
|
|
146
|
+
*/
|
|
82
147
|
export declare class ProtocolError extends Error {
|
|
148
|
+
static name: string;
|
|
83
149
|
constructor(message?: string);
|
|
84
150
|
}
|
|
151
|
+
/**
|
|
152
|
+
* Throw when an operation times out
|
|
153
|
+
*/
|
|
85
154
|
export declare class TimeoutError extends Error {
|
|
155
|
+
static name: string;
|
|
86
156
|
constructor(message?: string);
|
|
87
157
|
}
|
|
158
|
+
/**
|
|
159
|
+
* Thrown when a startable component is interacted with but it has not been
|
|
160
|
+
* started yet
|
|
161
|
+
*/
|
|
88
162
|
export declare class NotStartedError extends Error {
|
|
163
|
+
static name: string;
|
|
89
164
|
constructor(message?: string);
|
|
90
165
|
}
|
|
166
|
+
/**
|
|
167
|
+
* Thrown when a component is started that has already been started
|
|
168
|
+
*/
|
|
91
169
|
export declare class AlreadyStartedError extends Error {
|
|
170
|
+
static name: string;
|
|
92
171
|
constructor(message?: string);
|
|
93
172
|
}
|
|
173
|
+
/**
|
|
174
|
+
* Thrown when dialing an address failed
|
|
175
|
+
*/
|
|
94
176
|
export declare class DialError extends Error {
|
|
177
|
+
static name: string;
|
|
95
178
|
constructor(message?: string);
|
|
96
179
|
}
|
|
180
|
+
/**
|
|
181
|
+
* Thrown when listening on an address failed
|
|
182
|
+
*/
|
|
97
183
|
export declare class ListenError extends Error {
|
|
184
|
+
static name: string;
|
|
98
185
|
constructor(message?: string);
|
|
99
186
|
}
|
|
187
|
+
/**
|
|
188
|
+
* This error is thrown when a limited connection is encountered, i.e. if the
|
|
189
|
+
* user tried to open a stream on a connection for a protocol that is not
|
|
190
|
+
* configured to run over limited connections.
|
|
191
|
+
*/
|
|
100
192
|
export declare class LimitedConnectionError extends Error {
|
|
193
|
+
static name: string;
|
|
101
194
|
constructor(message?: string);
|
|
102
195
|
}
|
|
196
|
+
/**
|
|
197
|
+
* This error is thrown where there are too many inbound protocols streams open
|
|
198
|
+
*/
|
|
103
199
|
export declare class TooManyInboundProtocolStreamsError extends Error {
|
|
200
|
+
static name: string;
|
|
104
201
|
constructor(message?: string);
|
|
105
202
|
}
|
|
203
|
+
/**
|
|
204
|
+
* This error is thrown where there are too many outbound protocols streams open
|
|
205
|
+
*/
|
|
106
206
|
export declare class TooManyOutboundProtocolStreamsError extends Error {
|
|
207
|
+
static name: string;
|
|
107
208
|
constructor(message?: string);
|
|
108
209
|
}
|
|
109
210
|
/**
|
|
110
211
|
* Thrown when and attempt to operate on an unsupported key was made
|
|
111
212
|
*/
|
|
112
213
|
export declare class UnsupportedKeyTypeError extends Error {
|
|
214
|
+
static name: string;
|
|
113
215
|
constructor(message?: string);
|
|
114
216
|
}
|
|
115
217
|
//# sourceMappingURL=errors.d.ts.map
|
package/dist/src/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qBAAa,UAAW,SAAQ,KAAK;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACnC,MAAM,CAAC,IAAI,SAAe;gBAEb,OAAO,GAAE,MAAoC;CAI3D;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,MAAM,CAAC,IAAI,SAAwB;gBAEtB,OAAO,SAAoB;CAIzC;AAED;;GAEG;AACH,qBAAa,0BAA2B,SAAQ,KAAK;IACnD,MAAM,CAAC,IAAI,SAA+B;gBAE7B,OAAO,SAA4B;CAIjD;AAED;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C,MAAM,CAAC,IAAI,SAA2B;gBAEzB,OAAO,SAAuB;CAI5C;AAED;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,MAAM,CAAC,IAAI,SAA0B;gBAExB,OAAO,SAAuB;CAI5C;AAED;;GAEG;AACH,qBAAa,sBAAuB,SA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tC,OAAO,SAAuC;CAI5D;AAED;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,MAAM,CAAC,IAAI,SAA4B;gBAE1B,OAAO,SAAyB;CAI9C"}
|
package/dist/src/errors.js
CHANGED
|
@@ -4,134 +4,187 @@
|
|
|
4
4
|
* AbortSignal.
|
|
5
5
|
*/
|
|
6
6
|
export class AbortError extends Error {
|
|
7
|
+
static name = 'AbortError';
|
|
7
8
|
constructor(message = 'The operation was aborted') {
|
|
8
9
|
super(message);
|
|
9
10
|
this.name = 'AbortError';
|
|
10
11
|
}
|
|
11
12
|
}
|
|
12
13
|
/**
|
|
13
|
-
*
|
|
14
|
+
* Thrown when a remote Peer ID does not match the expected one
|
|
14
15
|
*/
|
|
15
|
-
export class CodeError extends Error {
|
|
16
|
-
code;
|
|
17
|
-
props;
|
|
18
|
-
constructor(message, code, props) {
|
|
19
|
-
super(message);
|
|
20
|
-
this.code = code;
|
|
21
|
-
this.name = props?.name ?? 'CodeError';
|
|
22
|
-
this.props = props ?? {}; // eslint-disable-line @typescript-eslint/consistent-type-assertions
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* @deprecated
|
|
27
|
-
*/
|
|
28
|
-
export class AggregateCodeError extends AggregateError {
|
|
29
|
-
code;
|
|
30
|
-
props;
|
|
31
|
-
constructor(errors, message, code, props) {
|
|
32
|
-
super(errors, message);
|
|
33
|
-
this.code = code;
|
|
34
|
-
this.name = props?.name ?? 'AggregateCodeError';
|
|
35
|
-
this.props = props ?? {}; // eslint-disable-line @typescript-eslint/consistent-type-assertions
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
16
|
export class UnexpectedPeerError extends Error {
|
|
17
|
+
static name = 'UnexpectedPeerError';
|
|
39
18
|
constructor(message = 'Unexpected Peer') {
|
|
40
19
|
super(message);
|
|
41
20
|
this.name = 'UnexpectedPeerError';
|
|
42
21
|
}
|
|
43
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Thrown when a crypto exchange fails
|
|
25
|
+
*/
|
|
44
26
|
export class InvalidCryptoExchangeError extends Error {
|
|
27
|
+
static name = 'InvalidCryptoExchangeError';
|
|
45
28
|
constructor(message = 'Invalid crypto exchange') {
|
|
46
29
|
super(message);
|
|
47
30
|
this.name = 'InvalidCryptoExchangeError';
|
|
48
31
|
}
|
|
49
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Thrown when invalid parameters are passed to a function or method call
|
|
35
|
+
*/
|
|
50
36
|
export class InvalidParametersError extends Error {
|
|
37
|
+
static name = 'InvalidParametersError';
|
|
51
38
|
constructor(message = 'Invalid parameters') {
|
|
52
39
|
super(message);
|
|
53
40
|
this.name = 'InvalidParametersError';
|
|
54
41
|
}
|
|
55
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Thrown when a public key is invalid
|
|
45
|
+
*/
|
|
56
46
|
export class InvalidPublicKeyError extends Error {
|
|
47
|
+
static name = 'InvalidPublicKeyError';
|
|
57
48
|
constructor(message = 'Invalid public key') {
|
|
58
49
|
super(message);
|
|
59
50
|
this.name = 'InvalidPublicKeyError';
|
|
60
51
|
}
|
|
61
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Thrown when a private key is invalid
|
|
55
|
+
*/
|
|
62
56
|
export class InvalidPrivateKeyError extends Error {
|
|
57
|
+
static name = 'InvalidPrivateKeyError';
|
|
63
58
|
constructor(message = 'Invalid private key') {
|
|
64
59
|
super(message);
|
|
65
60
|
this.name = 'InvalidPrivateKeyError';
|
|
66
61
|
}
|
|
67
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Thrown when a operation is unsupported
|
|
65
|
+
*/
|
|
68
66
|
export class UnsupportedOperationError extends Error {
|
|
67
|
+
static name = 'UnsupportedOperationError';
|
|
69
68
|
constructor(message = 'Unsupported operation') {
|
|
70
69
|
super(message);
|
|
71
70
|
this.name = 'UnsupportedOperationError';
|
|
72
71
|
}
|
|
73
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Thrown when a connection is closing
|
|
75
|
+
*/
|
|
74
76
|
export class ConnectionClosingError extends Error {
|
|
77
|
+
static name = 'ConnectionClosingError';
|
|
75
78
|
constructor(message = 'The connection is closing') {
|
|
76
79
|
super(message);
|
|
77
80
|
this.name = 'ConnectionClosingError';
|
|
78
81
|
}
|
|
79
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Thrown when a connection is closed
|
|
85
|
+
*/
|
|
80
86
|
export class ConnectionClosedError extends Error {
|
|
87
|
+
static name = 'ConnectionClosedError';
|
|
81
88
|
constructor(message = 'The connection is closed') {
|
|
82
89
|
super(message);
|
|
83
90
|
this.name = 'ConnectionClosedError';
|
|
84
91
|
}
|
|
85
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Thrown when a connection fails
|
|
95
|
+
*/
|
|
86
96
|
export class ConnectionFailedError extends Error {
|
|
97
|
+
static name = 'ConnectionFailedError';
|
|
87
98
|
constructor(message = 'Connection failed') {
|
|
88
99
|
super(message);
|
|
89
100
|
this.name = 'ConnectionFailedError';
|
|
90
101
|
}
|
|
91
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* Thrown when the muxer is closed and an attempt to open a stream occurs
|
|
105
|
+
*/
|
|
106
|
+
export class MuxerClosedError extends Error {
|
|
107
|
+
static name = 'MuxerClosedError';
|
|
108
|
+
constructor(message = 'The muxer is closed') {
|
|
109
|
+
super(message);
|
|
110
|
+
this.name = 'MuxerClosedError';
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Thrown when a protocol stream is reset by the remote muxer
|
|
115
|
+
*/
|
|
92
116
|
export class StreamResetError extends Error {
|
|
117
|
+
static name = 'StreamResetError';
|
|
93
118
|
constructor(message = 'The stream has been reset') {
|
|
94
119
|
super(message);
|
|
95
120
|
this.name = 'StreamResetError';
|
|
96
121
|
}
|
|
97
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* Thrown when a stream is in an invalid state
|
|
125
|
+
*/
|
|
98
126
|
export class StreamStateError extends Error {
|
|
127
|
+
static name = 'StreamStateError';
|
|
99
128
|
constructor(message = 'The stream is in an invalid state') {
|
|
100
129
|
super(message);
|
|
101
130
|
this.name = 'StreamStateError';
|
|
102
131
|
}
|
|
103
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* Thrown when a value could not be found
|
|
135
|
+
*/
|
|
104
136
|
export class NotFoundError extends Error {
|
|
137
|
+
static name = 'NotFoundError';
|
|
105
138
|
constructor(message = 'Not found') {
|
|
106
139
|
super(message);
|
|
107
140
|
this.name = 'NotFoundError';
|
|
108
141
|
}
|
|
109
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* Thrown when an invalid peer ID is encountered
|
|
145
|
+
*/
|
|
110
146
|
export class InvalidPeerIdError extends Error {
|
|
147
|
+
static name = 'InvalidPeerIdError';
|
|
111
148
|
constructor(message = 'Invalid PeerID') {
|
|
112
149
|
super(message);
|
|
113
150
|
this.name = 'InvalidPeerIdError';
|
|
114
151
|
}
|
|
115
152
|
}
|
|
153
|
+
/**
|
|
154
|
+
* Thrown when an invalid multiaddr is encountered
|
|
155
|
+
*/
|
|
116
156
|
export class InvalidMultiaddrError extends Error {
|
|
157
|
+
static name = 'InvalidMultiaddrError';
|
|
117
158
|
constructor(message = 'Invalid multiaddr') {
|
|
118
159
|
super(message);
|
|
119
160
|
this.name = 'InvalidMultiaddrError';
|
|
120
161
|
}
|
|
121
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* Thrown when an invalid CID is encountered
|
|
165
|
+
*/
|
|
122
166
|
export class InvalidCIDError extends Error {
|
|
167
|
+
static name = 'InvalidCIDError';
|
|
123
168
|
constructor(message = 'Invalid CID') {
|
|
124
169
|
super(message);
|
|
125
170
|
this.name = 'InvalidCIDError';
|
|
126
171
|
}
|
|
127
172
|
}
|
|
173
|
+
/**
|
|
174
|
+
* Thrown when an invalid multihash is encountered
|
|
175
|
+
*/
|
|
128
176
|
export class InvalidMultihashError extends Error {
|
|
177
|
+
static name = 'InvalidMultihashError';
|
|
129
178
|
constructor(message = 'Invalid Multihash') {
|
|
130
179
|
super(message);
|
|
131
180
|
this.name = 'InvalidMultihashError';
|
|
132
181
|
}
|
|
133
182
|
}
|
|
183
|
+
/**
|
|
184
|
+
* Thrown when a protocol is not supported
|
|
185
|
+
*/
|
|
134
186
|
export class UnsupportedProtocolError extends Error {
|
|
187
|
+
static name = 'UnsupportedProtocolError';
|
|
135
188
|
constructor(message = 'Unsupported protocol error') {
|
|
136
189
|
super(message);
|
|
137
190
|
this.name = 'UnsupportedProtocolError';
|
|
@@ -141,60 +194,101 @@ export class UnsupportedProtocolError extends Error {
|
|
|
141
194
|
* An invalid or malformed message was encountered during a protocol exchange
|
|
142
195
|
*/
|
|
143
196
|
export class InvalidMessageError extends Error {
|
|
197
|
+
static name = 'InvalidMessageError';
|
|
144
198
|
constructor(message = 'Invalid message') {
|
|
145
199
|
super(message);
|
|
146
200
|
this.name = 'InvalidMessageError';
|
|
147
201
|
}
|
|
148
202
|
}
|
|
203
|
+
/**
|
|
204
|
+
* Thrown when a remote peer sends a structurally valid message that does not
|
|
205
|
+
* comply with the protocol
|
|
206
|
+
*/
|
|
149
207
|
export class ProtocolError extends Error {
|
|
208
|
+
static name = 'ProtocolError';
|
|
150
209
|
constructor(message = 'Protocol error') {
|
|
151
210
|
super(message);
|
|
152
211
|
this.name = 'ProtocolError';
|
|
153
212
|
}
|
|
154
213
|
}
|
|
214
|
+
/**
|
|
215
|
+
* Throw when an operation times out
|
|
216
|
+
*/
|
|
155
217
|
export class TimeoutError extends Error {
|
|
218
|
+
static name = 'TimeoutError';
|
|
156
219
|
constructor(message = 'Timed out') {
|
|
157
220
|
super(message);
|
|
158
221
|
this.name = 'TimeoutError';
|
|
159
222
|
}
|
|
160
223
|
}
|
|
224
|
+
/**
|
|
225
|
+
* Thrown when a startable component is interacted with but it has not been
|
|
226
|
+
* started yet
|
|
227
|
+
*/
|
|
161
228
|
export class NotStartedError extends Error {
|
|
229
|
+
static name = 'NotStartedError';
|
|
162
230
|
constructor(message = 'Not started') {
|
|
163
231
|
super(message);
|
|
164
232
|
this.name = 'NotStartedError';
|
|
165
233
|
}
|
|
166
234
|
}
|
|
235
|
+
/**
|
|
236
|
+
* Thrown when a component is started that has already been started
|
|
237
|
+
*/
|
|
167
238
|
export class AlreadyStartedError extends Error {
|
|
239
|
+
static name = 'AlreadyStartedError';
|
|
168
240
|
constructor(message = 'Already started') {
|
|
169
241
|
super(message);
|
|
170
242
|
this.name = 'AlreadyStartedError';
|
|
171
243
|
}
|
|
172
244
|
}
|
|
245
|
+
/**
|
|
246
|
+
* Thrown when dialing an address failed
|
|
247
|
+
*/
|
|
173
248
|
export class DialError extends Error {
|
|
249
|
+
static name = 'DialError';
|
|
174
250
|
constructor(message = 'Dial error') {
|
|
175
251
|
super(message);
|
|
176
252
|
this.name = 'DialError';
|
|
177
253
|
}
|
|
178
254
|
}
|
|
255
|
+
/**
|
|
256
|
+
* Thrown when listening on an address failed
|
|
257
|
+
*/
|
|
179
258
|
export class ListenError extends Error {
|
|
259
|
+
static name = 'ListenError';
|
|
180
260
|
constructor(message = 'Listen error') {
|
|
181
261
|
super(message);
|
|
182
262
|
this.name = 'ListenError';
|
|
183
263
|
}
|
|
184
264
|
}
|
|
265
|
+
/**
|
|
266
|
+
* This error is thrown when a limited connection is encountered, i.e. if the
|
|
267
|
+
* user tried to open a stream on a connection for a protocol that is not
|
|
268
|
+
* configured to run over limited connections.
|
|
269
|
+
*/
|
|
185
270
|
export class LimitedConnectionError extends Error {
|
|
271
|
+
static name = 'LimitedConnectionError';
|
|
186
272
|
constructor(message = 'Limited connection') {
|
|
187
273
|
super(message);
|
|
188
274
|
this.name = 'LimitedConnectionError';
|
|
189
275
|
}
|
|
190
276
|
}
|
|
277
|
+
/**
|
|
278
|
+
* This error is thrown where there are too many inbound protocols streams open
|
|
279
|
+
*/
|
|
191
280
|
export class TooManyInboundProtocolStreamsError extends Error {
|
|
281
|
+
static name = 'TooManyInboundProtocolStreamsError';
|
|
192
282
|
constructor(message = 'Too many inbound protocol streams') {
|
|
193
283
|
super(message);
|
|
194
284
|
this.name = 'TooManyInboundProtocolStreamsError';
|
|
195
285
|
}
|
|
196
286
|
}
|
|
287
|
+
/**
|
|
288
|
+
* This error is thrown where there are too many outbound protocols streams open
|
|
289
|
+
*/
|
|
197
290
|
export class TooManyOutboundProtocolStreamsError extends Error {
|
|
291
|
+
static name = 'TooManyOutboundProtocolStreamsError';
|
|
198
292
|
constructor(message = 'Too many outbound protocol streams') {
|
|
199
293
|
super(message);
|
|
200
294
|
this.name = 'TooManyOutboundProtocolStreamsError';
|
|
@@ -204,6 +298,7 @@ export class TooManyOutboundProtocolStreamsError extends Error {
|
|
|
204
298
|
* Thrown when and attempt to operate on an unsupported key was made
|
|
205
299
|
*/
|
|
206
300
|
export class UnsupportedKeyTypeError extends Error {
|
|
301
|
+
static name = 'UnsupportedKeyTypeError';
|
|
207
302
|
constructor(message = 'Unsupported key type') {
|
|
208
303
|
super(message);
|
|
209
304
|
this.name = 'UnsupportedKeyTypeError';
|
package/dist/src/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,OAAO,UAAW,SAAQ,KAAK;IACnC,
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,OAAO,UAAW,SAAQ,KAAK;IACnC,MAAM,CAAC,IAAI,GAAG,YAAY,CAAA;IAE1B,YAAa,UAAkB,2BAA2B;QACxD,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,YAAY,CAAA;IAC1B,CAAC;;AAGH;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAC5C,MAAM,CAAC,IAAI,GAAG,qBAAqB,CAAA;IAEnC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,MAAM,CAAC,IAAI,GAAG,yBAAyB,CAAA;IAEvC,YAAa,OAAO,GAAG,sBAAsB;QAC3C,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAA;IACvC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/interface",
|
|
3
|
-
"version": "1.7.0-
|
|
3
|
+
"version": "1.7.0-e1ca9cced",
|
|
4
4
|
"description": "The interface implemented by a libp2p node",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
6
|
"homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/interface#readme",
|
package/src/errors.ts
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* AbortSignal.
|
|
5
5
|
*/
|
|
6
6
|
export class AbortError extends Error {
|
|
7
|
+
static name = 'AbortError'
|
|
8
|
+
|
|
7
9
|
constructor (message: string = 'The operation was aborted') {
|
|
8
10
|
super(message)
|
|
9
11
|
this.name = 'AbortError'
|
|
@@ -11,155 +13,215 @@ export class AbortError extends Error {
|
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
|
-
*
|
|
16
|
+
* Thrown when a remote Peer ID does not match the expected one
|
|
15
17
|
*/
|
|
16
|
-
export class CodeError<T extends Record<string, any> = Record<string, never>> extends Error {
|
|
17
|
-
public readonly props: T
|
|
18
|
-
|
|
19
|
-
constructor (
|
|
20
|
-
message: string,
|
|
21
|
-
public readonly code: string,
|
|
22
|
-
props?: T
|
|
23
|
-
) {
|
|
24
|
-
super(message)
|
|
25
|
-
|
|
26
|
-
this.name = props?.name ?? 'CodeError'
|
|
27
|
-
this.props = props ?? {} as T // eslint-disable-line @typescript-eslint/consistent-type-assertions
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* @deprecated
|
|
33
|
-
*/
|
|
34
|
-
export class AggregateCodeError<T extends Record<string, any> = Record<string, never>> extends AggregateError {
|
|
35
|
-
public readonly props: T
|
|
36
|
-
|
|
37
|
-
constructor (
|
|
38
|
-
errors: Error[],
|
|
39
|
-
message: string,
|
|
40
|
-
public readonly code: string,
|
|
41
|
-
props?: T
|
|
42
|
-
) {
|
|
43
|
-
super(errors, message)
|
|
44
|
-
|
|
45
|
-
this.name = props?.name ?? 'AggregateCodeError'
|
|
46
|
-
this.props = props ?? {} as T // eslint-disable-line @typescript-eslint/consistent-type-assertions
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
18
|
export class UnexpectedPeerError extends Error {
|
|
19
|
+
static name = 'UnexpectedPeerError'
|
|
20
|
+
|
|
51
21
|
constructor (message = 'Unexpected Peer') {
|
|
52
22
|
super(message)
|
|
53
23
|
this.name = 'UnexpectedPeerError'
|
|
54
24
|
}
|
|
55
25
|
}
|
|
56
26
|
|
|
27
|
+
/**
|
|
28
|
+
* Thrown when a crypto exchange fails
|
|
29
|
+
*/
|
|
57
30
|
export class InvalidCryptoExchangeError extends Error {
|
|
31
|
+
static name = 'InvalidCryptoExchangeError'
|
|
32
|
+
|
|
58
33
|
constructor (message = 'Invalid crypto exchange') {
|
|
59
34
|
super(message)
|
|
60
35
|
this.name = 'InvalidCryptoExchangeError'
|
|
61
36
|
}
|
|
62
37
|
}
|
|
63
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Thrown when invalid parameters are passed to a function or method call
|
|
41
|
+
*/
|
|
64
42
|
export class InvalidParametersError extends Error {
|
|
43
|
+
static name = 'InvalidParametersError'
|
|
44
|
+
|
|
65
45
|
constructor (message = 'Invalid parameters') {
|
|
66
46
|
super(message)
|
|
67
47
|
this.name = 'InvalidParametersError'
|
|
68
48
|
}
|
|
69
49
|
}
|
|
70
50
|
|
|
51
|
+
/**
|
|
52
|
+
* Thrown when a public key is invalid
|
|
53
|
+
*/
|
|
71
54
|
export class InvalidPublicKeyError extends Error {
|
|
55
|
+
static name = 'InvalidPublicKeyError'
|
|
56
|
+
|
|
72
57
|
constructor (message = 'Invalid public key') {
|
|
73
58
|
super(message)
|
|
74
59
|
this.name = 'InvalidPublicKeyError'
|
|
75
60
|
}
|
|
76
61
|
}
|
|
77
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Thrown when a private key is invalid
|
|
65
|
+
*/
|
|
78
66
|
export class InvalidPrivateKeyError extends Error {
|
|
67
|
+
static name = 'InvalidPrivateKeyError'
|
|
68
|
+
|
|
79
69
|
constructor (message = 'Invalid private key') {
|
|
80
70
|
super(message)
|
|
81
71
|
this.name = 'InvalidPrivateKeyError'
|
|
82
72
|
}
|
|
83
73
|
}
|
|
84
74
|
|
|
75
|
+
/**
|
|
76
|
+
* Thrown when a operation is unsupported
|
|
77
|
+
*/
|
|
85
78
|
export class UnsupportedOperationError extends Error {
|
|
79
|
+
static name = 'UnsupportedOperationError'
|
|
80
|
+
|
|
86
81
|
constructor (message = 'Unsupported operation') {
|
|
87
82
|
super(message)
|
|
88
83
|
this.name = 'UnsupportedOperationError'
|
|
89
84
|
}
|
|
90
85
|
}
|
|
91
86
|
|
|
87
|
+
/**
|
|
88
|
+
* Thrown when a connection is closing
|
|
89
|
+
*/
|
|
92
90
|
export class ConnectionClosingError extends Error {
|
|
91
|
+
static name = 'ConnectionClosingError'
|
|
92
|
+
|
|
93
93
|
constructor (message = 'The connection is closing') {
|
|
94
94
|
super(message)
|
|
95
95
|
this.name = 'ConnectionClosingError'
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
/**
|
|
100
|
+
* Thrown when a connection is closed
|
|
101
|
+
*/
|
|
99
102
|
export class ConnectionClosedError extends Error {
|
|
103
|
+
static name = 'ConnectionClosedError'
|
|
104
|
+
|
|
100
105
|
constructor (message = 'The connection is closed') {
|
|
101
106
|
super(message)
|
|
102
107
|
this.name = 'ConnectionClosedError'
|
|
103
108
|
}
|
|
104
109
|
}
|
|
105
110
|
|
|
111
|
+
/**
|
|
112
|
+
* Thrown when a connection fails
|
|
113
|
+
*/
|
|
106
114
|
export class ConnectionFailedError extends Error {
|
|
115
|
+
static name = 'ConnectionFailedError'
|
|
116
|
+
|
|
107
117
|
constructor (message = 'Connection failed') {
|
|
108
118
|
super(message)
|
|
109
119
|
this.name = 'ConnectionFailedError'
|
|
110
120
|
}
|
|
111
121
|
}
|
|
112
122
|
|
|
123
|
+
/**
|
|
124
|
+
* Thrown when the muxer is closed and an attempt to open a stream occurs
|
|
125
|
+
*/
|
|
126
|
+
export class MuxerClosedError extends Error {
|
|
127
|
+
static name = 'MuxerClosedError'
|
|
128
|
+
|
|
129
|
+
constructor (message = 'The muxer is closed') {
|
|
130
|
+
super(message)
|
|
131
|
+
this.name = 'MuxerClosedError'
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Thrown when a protocol stream is reset by the remote muxer
|
|
137
|
+
*/
|
|
113
138
|
export class StreamResetError extends Error {
|
|
139
|
+
static name = 'StreamResetError'
|
|
140
|
+
|
|
114
141
|
constructor (message = 'The stream has been reset') {
|
|
115
142
|
super(message)
|
|
116
143
|
this.name = 'StreamResetError'
|
|
117
144
|
}
|
|
118
145
|
}
|
|
119
146
|
|
|
147
|
+
/**
|
|
148
|
+
* Thrown when a stream is in an invalid state
|
|
149
|
+
*/
|
|
120
150
|
export class StreamStateError extends Error {
|
|
151
|
+
static name = 'StreamStateError'
|
|
152
|
+
|
|
121
153
|
constructor (message = 'The stream is in an invalid state') {
|
|
122
154
|
super(message)
|
|
123
155
|
this.name = 'StreamStateError'
|
|
124
156
|
}
|
|
125
157
|
}
|
|
126
158
|
|
|
159
|
+
/**
|
|
160
|
+
* Thrown when a value could not be found
|
|
161
|
+
*/
|
|
127
162
|
export class NotFoundError extends Error {
|
|
163
|
+
static name = 'NotFoundError'
|
|
164
|
+
|
|
128
165
|
constructor (message = 'Not found') {
|
|
129
166
|
super(message)
|
|
130
167
|
this.name = 'NotFoundError'
|
|
131
168
|
}
|
|
132
169
|
}
|
|
133
170
|
|
|
171
|
+
/**
|
|
172
|
+
* Thrown when an invalid peer ID is encountered
|
|
173
|
+
*/
|
|
134
174
|
export class InvalidPeerIdError extends Error {
|
|
175
|
+
static name = 'InvalidPeerIdError'
|
|
176
|
+
|
|
135
177
|
constructor (message = 'Invalid PeerID') {
|
|
136
178
|
super(message)
|
|
137
179
|
this.name = 'InvalidPeerIdError'
|
|
138
180
|
}
|
|
139
181
|
}
|
|
140
182
|
|
|
183
|
+
/**
|
|
184
|
+
* Thrown when an invalid multiaddr is encountered
|
|
185
|
+
*/
|
|
141
186
|
export class InvalidMultiaddrError extends Error {
|
|
187
|
+
static name = 'InvalidMultiaddrError'
|
|
188
|
+
|
|
142
189
|
constructor (message = 'Invalid multiaddr') {
|
|
143
190
|
super(message)
|
|
144
191
|
this.name = 'InvalidMultiaddrError'
|
|
145
192
|
}
|
|
146
193
|
}
|
|
147
194
|
|
|
195
|
+
/**
|
|
196
|
+
* Thrown when an invalid CID is encountered
|
|
197
|
+
*/
|
|
148
198
|
export class InvalidCIDError extends Error {
|
|
199
|
+
static name = 'InvalidCIDError'
|
|
200
|
+
|
|
149
201
|
constructor (message = 'Invalid CID') {
|
|
150
202
|
super(message)
|
|
151
203
|
this.name = 'InvalidCIDError'
|
|
152
204
|
}
|
|
153
205
|
}
|
|
154
206
|
|
|
207
|
+
/**
|
|
208
|
+
* Thrown when an invalid multihash is encountered
|
|
209
|
+
*/
|
|
155
210
|
export class InvalidMultihashError extends Error {
|
|
211
|
+
static name = 'InvalidMultihashError'
|
|
212
|
+
|
|
156
213
|
constructor (message = 'Invalid Multihash') {
|
|
157
214
|
super(message)
|
|
158
215
|
this.name = 'InvalidMultihashError'
|
|
159
216
|
}
|
|
160
217
|
}
|
|
161
218
|
|
|
219
|
+
/**
|
|
220
|
+
* Thrown when a protocol is not supported
|
|
221
|
+
*/
|
|
162
222
|
export class UnsupportedProtocolError extends Error {
|
|
223
|
+
static name = 'UnsupportedProtocolError'
|
|
224
|
+
|
|
163
225
|
constructor (message = 'Unsupported protocol error') {
|
|
164
226
|
super(message)
|
|
165
227
|
this.name = 'UnsupportedProtocolError'
|
|
@@ -170,69 +232,120 @@ export class UnsupportedProtocolError extends Error {
|
|
|
170
232
|
* An invalid or malformed message was encountered during a protocol exchange
|
|
171
233
|
*/
|
|
172
234
|
export class InvalidMessageError extends Error {
|
|
235
|
+
static name = 'InvalidMessageError'
|
|
236
|
+
|
|
173
237
|
constructor (message = 'Invalid message') {
|
|
174
238
|
super(message)
|
|
175
239
|
this.name = 'InvalidMessageError'
|
|
176
240
|
}
|
|
177
241
|
}
|
|
178
242
|
|
|
243
|
+
/**
|
|
244
|
+
* Thrown when a remote peer sends a structurally valid message that does not
|
|
245
|
+
* comply with the protocol
|
|
246
|
+
*/
|
|
179
247
|
export class ProtocolError extends Error {
|
|
248
|
+
static name = 'ProtocolError'
|
|
249
|
+
|
|
180
250
|
constructor (message = 'Protocol error') {
|
|
181
251
|
super(message)
|
|
182
252
|
this.name = 'ProtocolError'
|
|
183
253
|
}
|
|
184
254
|
}
|
|
185
255
|
|
|
256
|
+
/**
|
|
257
|
+
* Throw when an operation times out
|
|
258
|
+
*/
|
|
186
259
|
export class TimeoutError extends Error {
|
|
260
|
+
static name = 'TimeoutError'
|
|
261
|
+
|
|
187
262
|
constructor (message = 'Timed out') {
|
|
188
263
|
super(message)
|
|
189
264
|
this.name = 'TimeoutError'
|
|
190
265
|
}
|
|
191
266
|
}
|
|
192
267
|
|
|
268
|
+
/**
|
|
269
|
+
* Thrown when a startable component is interacted with but it has not been
|
|
270
|
+
* started yet
|
|
271
|
+
*/
|
|
193
272
|
export class NotStartedError extends Error {
|
|
273
|
+
static name = 'NotStartedError'
|
|
274
|
+
|
|
194
275
|
constructor (message = 'Not started') {
|
|
195
276
|
super(message)
|
|
196
277
|
this.name = 'NotStartedError'
|
|
197
278
|
}
|
|
198
279
|
}
|
|
199
280
|
|
|
281
|
+
/**
|
|
282
|
+
* Thrown when a component is started that has already been started
|
|
283
|
+
*/
|
|
200
284
|
export class AlreadyStartedError extends Error {
|
|
285
|
+
static name = 'AlreadyStartedError'
|
|
286
|
+
|
|
201
287
|
constructor (message = 'Already started') {
|
|
202
288
|
super(message)
|
|
203
289
|
this.name = 'AlreadyStartedError'
|
|
204
290
|
}
|
|
205
291
|
}
|
|
206
292
|
|
|
293
|
+
/**
|
|
294
|
+
* Thrown when dialing an address failed
|
|
295
|
+
*/
|
|
207
296
|
export class DialError extends Error {
|
|
297
|
+
static name = 'DialError'
|
|
298
|
+
|
|
208
299
|
constructor (message = 'Dial error') {
|
|
209
300
|
super(message)
|
|
210
301
|
this.name = 'DialError'
|
|
211
302
|
}
|
|
212
303
|
}
|
|
213
304
|
|
|
305
|
+
/**
|
|
306
|
+
* Thrown when listening on an address failed
|
|
307
|
+
*/
|
|
214
308
|
export class ListenError extends Error {
|
|
309
|
+
static name = 'ListenError'
|
|
310
|
+
|
|
215
311
|
constructor (message = 'Listen error') {
|
|
216
312
|
super(message)
|
|
217
313
|
this.name = 'ListenError'
|
|
218
314
|
}
|
|
219
315
|
}
|
|
220
316
|
|
|
317
|
+
/**
|
|
318
|
+
* This error is thrown when a limited connection is encountered, i.e. if the
|
|
319
|
+
* user tried to open a stream on a connection for a protocol that is not
|
|
320
|
+
* configured to run over limited connections.
|
|
321
|
+
*/
|
|
221
322
|
export class LimitedConnectionError extends Error {
|
|
323
|
+
static name = 'LimitedConnectionError'
|
|
324
|
+
|
|
222
325
|
constructor (message = 'Limited connection') {
|
|
223
326
|
super(message)
|
|
224
327
|
this.name = 'LimitedConnectionError'
|
|
225
328
|
}
|
|
226
329
|
}
|
|
227
330
|
|
|
331
|
+
/**
|
|
332
|
+
* This error is thrown where there are too many inbound protocols streams open
|
|
333
|
+
*/
|
|
228
334
|
export class TooManyInboundProtocolStreamsError extends Error {
|
|
335
|
+
static name = 'TooManyInboundProtocolStreamsError'
|
|
336
|
+
|
|
229
337
|
constructor (message = 'Too many inbound protocol streams') {
|
|
230
338
|
super(message)
|
|
231
339
|
this.name = 'TooManyInboundProtocolStreamsError'
|
|
232
340
|
}
|
|
233
341
|
}
|
|
234
342
|
|
|
343
|
+
/**
|
|
344
|
+
* This error is thrown where there are too many outbound protocols streams open
|
|
345
|
+
*/
|
|
235
346
|
export class TooManyOutboundProtocolStreamsError extends Error {
|
|
347
|
+
static name = 'TooManyOutboundProtocolStreamsError'
|
|
348
|
+
|
|
236
349
|
constructor (message = 'Too many outbound protocol streams') {
|
|
237
350
|
super(message)
|
|
238
351
|
this.name = 'TooManyOutboundProtocolStreamsError'
|
|
@@ -243,6 +356,8 @@ export class TooManyOutboundProtocolStreamsError extends Error {
|
|
|
243
356
|
* Thrown when and attempt to operate on an unsupported key was made
|
|
244
357
|
*/
|
|
245
358
|
export class UnsupportedKeyTypeError extends Error {
|
|
359
|
+
static name = 'UnsupportedKeyTypeError'
|
|
360
|
+
|
|
246
361
|
constructor (message = 'Unsupported key type') {
|
|
247
362
|
super(message)
|
|
248
363
|
this.name = 'UnsupportedKeyTypeError'
|