mirror of
https://github.com/status-im/nim-dagger.git
synced 2025-01-10 14:46:03 +00:00
e47b38af11
* Fixes/workarounds for nimsuggest failures in codex.nim. * remove rng prefix - it appears to work now * format new's to be more consistent * making proc formatting a bit more consistent
24 lines
692 B
Nim
24 lines
692 B
Nim
## Nim-Codex
|
|
## Copyright (c) 2021 Status Research & Development GmbH
|
|
## Licensed under either of
|
|
## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
|
|
## * MIT license ([LICENSE-MIT](LICENSE-MIT))
|
|
## at your option.
|
|
## This file may not be copied, modified, or distributed except according to
|
|
## those terms.
|
|
|
|
import pkg/stew/results
|
|
|
|
type
|
|
CodexError* = object of CatchableError # base codex error
|
|
CodexResult*[T] = Result[T, ref CodexError]
|
|
|
|
template mapFailure*(
|
|
exp: untyped,
|
|
exc: typed = type CodexError
|
|
): untyped =
|
|
## Convert `Result[T, E]` to `Result[E, ref CatchableError]`
|
|
##
|
|
|
|
((exp.mapErr do (e: auto) -> ref CatchableError: (ref exc)(msg: $e)))
|