@@ -6,7 +6,7 @@ import { MessageTypes, MessageTypeNames, Message } from './message-types.js'
6
6
import { createStream } from './stream.js'
7
7
import { toString as uint8ArrayToString } from 'uint8arrays'
8
8
import { logger } from '@libp2p/logger'
9
- import errCode from 'err-code '
9
+ import { CodeError } from '@libp2p/interfaces/errors '
10
10
import { RateLimiterMemory } from 'rate-limiter-flexible'
11
11
import type { Sink } from 'it-stream-types'
12
12
import type { StreamMuxer , StreamMuxerInit } from '@libp2p/interface-stream-muxer'
@@ -157,7 +157,7 @@ export class MplexStreamMuxer implements StreamMuxer {
157
157
log ( 'new %s stream %s' , type , id )
158
158
159
159
if ( type === 'initiator' && this . _streams . initiators . size === ( this . _init . maxOutboundStreams ?? MAX_STREAMS_OUTBOUND_STREAMS_PER_CONNECTION ) ) {
160
- throw errCode ( new Error ( 'Too many outbound streams open' ) , 'ERR_TOO_MANY_OUTBOUND_STREAMS' )
160
+ throw new CodeError ( 'Too many outbound streams open' , 'ERR_TOO_MANY_OUTBOUND_STREAMS' )
161
161
}
162
162
163
163
if ( registry . has ( id ) ) {
@@ -303,7 +303,7 @@ export class MplexStreamMuxer implements StreamMuxer {
303
303
} )
304
304
305
305
// Inform the stream consumer they are not fast enough
306
- const error = errCode ( new Error ( 'Input buffer full - increase Mplex maxBufferSize to accommodate slow consumers' ) , 'ERR_STREAM_INPUT_BUFFER_FULL' )
306
+ const error = new CodeError ( 'Input buffer full - increase Mplex maxBufferSize to accommodate slow consumers' , 'ERR_STREAM_INPUT_BUFFER_FULL' )
307
307
stream . abort ( error )
308
308
309
309
return
0 commit comments