Use CatchableError
This commit is contained in:
parent
b706b994ec
commit
d5b51bcf9e
|
@ -48,7 +48,7 @@ type
|
||||||
Base32Types* = Base32NoPadTypes | Base32PadTypes
|
Base32Types* = Base32NoPadTypes | Base32PadTypes
|
||||||
## Supported types
|
## Supported types
|
||||||
|
|
||||||
Base32Error* = object of Exception
|
Base32Error* = object of CatchableError
|
||||||
## Base32 specific exception type
|
## Base32 specific exception type
|
||||||
|
|
||||||
proc newAlphabet32*(s: string): Base32Alphabet =
|
proc newAlphabet32*(s: string): Base32Alphabet =
|
||||||
|
|
|
@ -30,7 +30,7 @@ type
|
||||||
Base58C* = BTCBase58 | FLCBase58
|
Base58C* = BTCBase58 | FLCBase58
|
||||||
## Supported types
|
## Supported types
|
||||||
|
|
||||||
Base58Error* = object of Exception
|
Base58Error* = object of CatchableError
|
||||||
## Base58 specific exception type
|
## Base58 specific exception type
|
||||||
|
|
||||||
proc newAlphabet58*(s: string): Base58Alphabet =
|
proc newAlphabet58*(s: string): Base58Alphabet =
|
||||||
|
|
|
@ -36,7 +36,7 @@ type
|
||||||
Base64Types* = Base64 | Base64Pad | Base64Url | Base64UrlPad
|
Base64Types* = Base64 | Base64Pad | Base64Url | Base64UrlPad
|
||||||
## All types
|
## All types
|
||||||
|
|
||||||
Base64Error* = object of Exception
|
Base64Error* = object of CatchableError
|
||||||
## Base64 specific exception type
|
## Base64 specific exception type
|
||||||
|
|
||||||
proc newAlphabet64*(s: string): Base64Alphabet =
|
proc newAlphabet64*(s: string): Base64Alphabet =
|
||||||
|
|
|
@ -24,7 +24,7 @@ type
|
||||||
hpos*: int
|
hpos*: int
|
||||||
data*: VBuffer
|
data*: VBuffer
|
||||||
|
|
||||||
CidError* = object of Exception
|
CidError* = object of CatchableError
|
||||||
|
|
||||||
const
|
const
|
||||||
ContentIdsList = [
|
ContentIdsList = [
|
||||||
|
|
|
@ -74,8 +74,8 @@ type
|
||||||
Signature* = object
|
Signature* = object
|
||||||
data*: seq[byte]
|
data*: seq[byte]
|
||||||
|
|
||||||
P2pKeyError* = object of Exception
|
P2pKeyError* = object of CatchableError
|
||||||
P2pSigError* = object of Exception
|
P2pSigError* = object of CatchableError
|
||||||
|
|
||||||
const
|
const
|
||||||
SupportedSchemes* = {RSA, Ed25519, ECDSA}
|
SupportedSchemes* = {RSA, Ed25519, ECDSA}
|
||||||
|
|
|
@ -56,11 +56,11 @@ type
|
||||||
|
|
||||||
EcPKI* = EcPrivateKey | EcPublicKey | EcSignature
|
EcPKI* = EcPrivateKey | EcPublicKey | EcSignature
|
||||||
|
|
||||||
EcError* = object of Exception
|
EcError* = object of CatchableError
|
||||||
EcKeyIncorrectError* = object of EcError
|
EcKeyIncorrectError* = object of EcError
|
||||||
EcRngError* = object of EcError
|
EcRngError* = object of EcError
|
||||||
EcPublicKeyError* = object of EcError
|
EcPublicKeyError* = object of EcError
|
||||||
EcSignatureError = object of EcError
|
EcSignatureError* = object of EcError
|
||||||
|
|
||||||
const
|
const
|
||||||
EcSupportedCurvesCint* = {cint(Secp256r1), cint(Secp384r1), cint(Secp521r1)}
|
EcSupportedCurvesCint* = {cint(Secp256r1), cint(Secp384r1), cint(Secp521r1)}
|
||||||
|
|
|
@ -38,7 +38,7 @@ type
|
||||||
seckey*: EdPrivateKey
|
seckey*: EdPrivateKey
|
||||||
pubkey*: EdPublicKey
|
pubkey*: EdPublicKey
|
||||||
|
|
||||||
EdError* = object of Exception
|
EdError* = object of CatchableError
|
||||||
EdRngError* = object of EdError
|
EdRngError* = object of EdError
|
||||||
EdIncorrectError* = object of EdError
|
EdIncorrectError* = object of EdError
|
||||||
|
|
||||||
|
|
|
@ -70,11 +70,11 @@ type
|
||||||
RsaPKI* = RsaPrivateKey | RsaPublicKey | RsaSignature
|
RsaPKI* = RsaPrivateKey | RsaPublicKey | RsaSignature
|
||||||
RsaKP* = RsaPrivateKey | RsaKeyPair
|
RsaKP* = RsaPrivateKey | RsaKeyPair
|
||||||
|
|
||||||
RsaError = object of Exception
|
RsaError* = object of CatchableError
|
||||||
RsaRngError = object of RsaError
|
RsaRngError* = object of RsaError
|
||||||
RsaGenError = object of RsaError
|
RsaGenError* = object of RsaError
|
||||||
RsaKeyIncorrectError = object of RsaError
|
RsaKeyIncorrectError* = object of RsaError
|
||||||
RsaSignatureError = object of RsaError
|
RsaSignatureError* = object of RsaError
|
||||||
|
|
||||||
template getStart(bs, os, ls: untyped): untyped =
|
template getStart(bs, os, ls: untyped): untyped =
|
||||||
let p = cast[uint](os)
|
let p = cast[uint](os)
|
||||||
|
|
|
@ -146,8 +146,8 @@ type
|
||||||
ticket: PubsubTicket,
|
ticket: PubsubTicket,
|
||||||
message: PubSubMessage): Future[bool] {.gcsafe.}
|
message: PubSubMessage): Future[bool] {.gcsafe.}
|
||||||
|
|
||||||
DaemonRemoteError* = object of Exception
|
DaemonRemoteError* = object of CatchableError
|
||||||
DaemonLocalError* = object of Exception
|
DaemonLocalError* = object of CatchableError
|
||||||
|
|
||||||
var daemonsCount {.threadvar.}: int
|
var daemonsCount {.threadvar.}: int
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ type
|
||||||
flag*: bool
|
flag*: bool
|
||||||
rem*: seq[MultiCodec]
|
rem*: seq[MultiCodec]
|
||||||
|
|
||||||
MultiAddressError* = object of Exception
|
MultiAddressError* = object of CatchableError
|
||||||
|
|
||||||
proc ip4StB(s: string, vb: var VBuffer): bool =
|
proc ip4StB(s: string, vb: var VBuffer): bool =
|
||||||
## IPv4 stringToBuffer() implementation.
|
## IPv4 stringToBuffer() implementation.
|
||||||
|
|
|
@ -38,7 +38,7 @@ type
|
||||||
encl: MBCodeSize
|
encl: MBCodeSize
|
||||||
decl: MBCodeSize
|
decl: MBCodeSize
|
||||||
|
|
||||||
MultiBaseError* = object of Exception
|
MultiBaseError* = object of CatchableError
|
||||||
|
|
||||||
proc idd(inbytes: openarray[char], outbytes: var openarray[byte],
|
proc idd(inbytes: openarray[char], outbytes: var openarray[byte],
|
||||||
outlen: var int): MultibaseStatus =
|
outlen: var int): MultibaseStatus =
|
||||||
|
|
|
@ -230,7 +230,7 @@ const MultiCodecList = [
|
||||||
|
|
||||||
type
|
type
|
||||||
MultiCodec* = distinct int
|
MultiCodec* = distinct int
|
||||||
MultiCodecError* = object of Exception
|
MultiCodecError* = object of CatchableError
|
||||||
|
|
||||||
const
|
const
|
||||||
InvalidMultiCodec* = MultiCodec(-1)
|
InvalidMultiCodec* = MultiCodec(-1)
|
||||||
|
|
|
@ -44,7 +44,7 @@ type
|
||||||
size*: int
|
size*: int
|
||||||
dpos*: int
|
dpos*: int
|
||||||
|
|
||||||
MultiHashError* = object of Exception
|
MultiHashError* = object of CatchableError
|
||||||
|
|
||||||
proc identhash(data: openarray[byte], output: var openarray[byte]) =
|
proc identhash(data: openarray[byte], output: var openarray[byte]) =
|
||||||
if len(output) > 0:
|
if len(output) > 0:
|
||||||
|
|
|
@ -20,7 +20,7 @@ type
|
||||||
PeerID* = object
|
PeerID* = object
|
||||||
data*: seq[byte]
|
data*: seq[byte]
|
||||||
|
|
||||||
PeerIDError* = object of Exception
|
PeerIDError* = object of CatchableError
|
||||||
|
|
||||||
proc pretty*(pid: PeerID): string {.inline.} =
|
proc pretty*(pid: PeerID): string {.inline.} =
|
||||||
## Return base58 encoded ``pid`` representation.
|
## Return base58 encoded ``pid`` representation.
|
||||||
|
|
|
@ -35,7 +35,7 @@ type
|
||||||
LPSomeVarint* = LPSomeUVarint
|
LPSomeVarint* = LPSomeUVarint
|
||||||
SomeVarint* = PBSomeVarint | LPSomeVarint
|
SomeVarint* = PBSomeVarint | LPSomeVarint
|
||||||
SomeUVarint* = PBSomeUVarint | LPSomeUVarint
|
SomeUVarint* = PBSomeUVarint | LPSomeUVarint
|
||||||
VarintError* = object of Exception
|
VarintError* = object of CatchableError
|
||||||
|
|
||||||
proc vsizeof*(x: SomeVarint): int {.inline.} =
|
proc vsizeof*(x: SomeVarint): int {.inline.} =
|
||||||
## Returns number of bytes required to encode integer ``x`` as varint.
|
## Returns number of bytes required to encode integer ``x`` as varint.
|
||||||
|
|
Loading…
Reference in New Issue