mirror of
https://github.com/logos-storage/questionable.git
synced 2026-01-05 15:23:08 +00:00
Get rid of trick with type parameter
This commit is contained in:
parent
d463d491cc
commit
672248f431
@ -24,13 +24,13 @@ macro captureBindError*(error: var ref CatchableError, expression): auto =
|
|||||||
func error[T](option: Option[T]): ref CatchableError =
|
func error[T](option: Option[T]): ref CatchableError =
|
||||||
newException(ValueError, "Option is set to `none`")
|
newException(ValueError, "Option is set to `none`")
|
||||||
|
|
||||||
macro bindFailed*(expression; _: type = void) =
|
macro bindFailed*(expression: typed) =
|
||||||
## Called when a binding (=?) fails.
|
## Called when a binding (=?) fails.
|
||||||
## Assigns an error to the error variable (specified in captureBindError())
|
## Assigns an error to the error variable (specified in captureBindError())
|
||||||
## when appropriate.
|
## when appropriate.
|
||||||
|
|
||||||
# This macro has a type parameter to ensure that the compiler does not
|
# The `expression` parameter is typed to ensure that the compiler does not
|
||||||
# expand it before it expands invocations of captureBindError().
|
# expand bindFailed() before it expands invocations of captureBindError().
|
||||||
|
|
||||||
# check that we have an error variable on the stack
|
# check that we have an error variable on the stack
|
||||||
if errorVariableNames.len > 0:
|
if errorVariableNames.len > 0:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user