print warning when calling failed (#521)
`failed` cannot return true for futures that don't forward exceptions
This commit is contained in:
parent
17b7a76c7e
commit
47cc17719f
|
@ -2,6 +2,8 @@ import
|
||||||
std/[macros, sequtils],
|
std/[macros, sequtils],
|
||||||
../futures
|
../futures
|
||||||
|
|
||||||
|
{.push raises: [].}
|
||||||
|
|
||||||
type
|
type
|
||||||
InternalRaisesFuture*[T, E] = ref object of Future[T]
|
InternalRaisesFuture*[T, E] = ref object of Future[T]
|
||||||
## Future with a tuple of possible exception types
|
## Future with a tuple of possible exception types
|
||||||
|
@ -205,13 +207,20 @@ macro checkRaises*[T: CatchableError](
|
||||||
`warning`
|
`warning`
|
||||||
assert(`runtimeChecker`, `errorMsg`)
|
assert(`runtimeChecker`, `errorMsg`)
|
||||||
|
|
||||||
proc error*[T](future: InternalRaisesFuture[T, void]): ref CatchableError {.
|
func failed*[T](future: InternalRaisesFuture[T, void]): bool {.inline.} =
|
||||||
|
## Determines whether ``future`` finished with an error.
|
||||||
|
static:
|
||||||
|
warning("No exceptions possible with this operation, `failed` always returns false")
|
||||||
|
|
||||||
|
false
|
||||||
|
|
||||||
|
func error*[T](future: InternalRaisesFuture[T, void]): ref CatchableError {.
|
||||||
raises: [].} =
|
raises: [].} =
|
||||||
static:
|
static:
|
||||||
warning("No exceptions possible with this operation, `error` always returns nil")
|
warning("No exceptions possible with this operation, `error` always returns nil")
|
||||||
nil
|
nil
|
||||||
|
|
||||||
proc readError*[T](future: InternalRaisesFuture[T, void]): ref CatchableError {.
|
func readError*[T](future: InternalRaisesFuture[T, void]): ref CatchableError {.
|
||||||
raises: [ValueError].} =
|
raises: [ValueError].} =
|
||||||
static:
|
static:
|
||||||
warning("No exceptions possible with this operation, `readError` always raises")
|
warning("No exceptions possible with this operation, `readError` always raises")
|
||||||
|
|
Loading…
Reference in New Issue