add base exception class and fix hierarchy

This commit is contained in:
Dmitriy Ryajov 2021-01-28 16:12:54 -06:00
parent a3c00af945
commit 8e3ef540ea
No known key found for this signature in database
GPG Key ID: DA8C680CE7C657A4
3 changed files with 10 additions and 9 deletions

View File

@ -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

View File

@ -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]]

View File

@ -17,6 +17,8 @@ import ../varint,
../multiaddress,
../errors
export errors
declareGauge(libp2p_open_streams,
"open stream instances", labels = ["type", "dir"])