# Nimbus # Copyright (c) 2018 Status Research & Development GmbH # Licensed under either of # * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or # http://www.apache.org/licenses/LICENSE-2.0) # * MIT license ([LICENSE-MIT](LICENSE-MIT) or # http://opensource.org/licenses/MIT) # at your option. This file may not be copied, modified, or distributed except # according to those terms. type P2PChainError* = object of CatchableError ## Catch and relay exception error {.push raises: [Defect].} template safeP2PChain*(info: string; code: untyped) = try: code except CatchableError as e: raise (ref CatchableError)(msg: e.msg) except Defect as e: raise (ref Defect)(msg: e.msg) except: let e = getCurrentException() raise newException(P2PChainError, info & "(): " & $e.name & " -- " & e.msg) # End