reraise defect in generic exception handler

This commit is contained in:
Jacek Sieka 2020-04-06 20:08:39 +02:00
parent 021e7d6528
commit e1d18b431b
No known key found for this signature in database
GPG Key ID: A1B09461ABB656B8
1 changed files with 4 additions and 3 deletions

View File

@ -57,10 +57,11 @@ proc toENode*(a: MultiAddress): Result[ENode, cstring] {.raises: [Defect].} =
except CatchableError: except CatchableError:
# This will reach the error exit path below # This will reach the error exit path below
discard discard
except Exception: except Exception as e:
# TODO: # TODO:
# libp2p/crypto/ecnist.nim(118, 20) Error: can raise an unlisted exception: Exception # nim-libp2p/libp2p/multiaddress.nim(616, 40) Error: can raise an unlisted exception: Exception
discard if e of Defect:
raise (ref Defect)(e)
return err "Invalid MultiAddress" return err "Invalid MultiAddress"