mirror of https://github.com/vacp2p/nim-libp2p.git
add base exception class and fix hierarchy
This commit is contained in:
parent
a3c00af945
commit
8e3ef540ea
|
@ -13,8 +13,8 @@
|
|||
import std/[os, osproc, strutils, tables, strtabs]
|
||||
import pkg/[chronos, chronicles]
|
||||
import ../varint, ../multiaddress, ../multicodec, ../cid, ../peerid
|
||||
import ../wire, ../multihash, ../protobuf/minprotobuf
|
||||
import ../crypto/crypto, ../errors
|
||||
import ../wire, ../multihash, ../protobuf/minprotobuf, ../errors
|
||||
import ../crypto/crypto
|
||||
|
||||
export
|
||||
peerid, multiaddress, multicodec, multihash, cid, crypto, wire, errors
|
||||
|
@ -155,11 +155,9 @@ type
|
|||
ticket: PubsubTicket,
|
||||
message: PubSubMessage): Future[bool] {.gcsafe.}
|
||||
|
||||
# TODO: would be nice to be able to map other errors to
|
||||
# this types with `Result.toException`, but it doesn't work
|
||||
# in this module
|
||||
DaemonRemoteError* = object of CatchableError
|
||||
DaemonLocalError* = object of CatchableError
|
||||
DaemonError* = object of LPError
|
||||
DaemonRemoteError* = object of DaemonError
|
||||
DaemonLocalError* = object of DaemonError
|
||||
|
||||
var daemonsCount {.threadvar.}: int
|
||||
|
||||
|
|
|
@ -34,8 +34,9 @@ when defined(libp2p_expensive_metrics):
|
|||
"mplex channels", labels = ["initiator", "peer"])
|
||||
|
||||
type
|
||||
TooManyChannels* = object of MuxerError
|
||||
InvalidChannelIdError* = object of MuxerError
|
||||
MplexError* = object of MuxerError
|
||||
TooManyChannels* = object of MplexError
|
||||
InvalidChannelIdError* = object of MplexError
|
||||
|
||||
Mplex* = ref object of Muxer
|
||||
channels: array[bool, Table[uint64, LPChannel]]
|
||||
|
|
|
@ -17,6 +17,8 @@ import ../varint,
|
|||
../multiaddress,
|
||||
../errors
|
||||
|
||||
export errors
|
||||
|
||||
declareGauge(libp2p_open_streams,
|
||||
"open stream instances", labels = ["type", "dir"])
|
||||
|
||||
|
|
Loading…
Reference in New Issue