Types
InternalRaisesFuture[T; E] = ref object of Future[T] when E is void: dummy: E else: dummy: array[0, E]
-
Future with a tuple of possible exception types eg InternalRaisesFuture[void, (ValueError, OSError)]
This type gets injected by async: (raises: ...) and similar utilities and should not be used manually as the internal exception representation is subject to change in future chronos versions.
Source Edit
Procs
func error[T](future: InternalRaisesFuture[T, void]): ref CatchableError {. ...raises: [], raises: [].}
- Source Edit
func failed[T](future: InternalRaisesFuture[T, void]): bool {.inline, ...raises: [].}
- Determines whether future finished with an error. Source Edit
proc getRaisesTypes(raises: NimNode): NimNode {....raises: [], tags: [].}
- Source Edit
proc isNoRaises(n: NimNode): bool {.compileTime, ...raises: [], tags: [].}
- Source Edit
proc makeNoRaises(): NimNode {.compileTime, ...raises: [], tags: [].}
- Source Edit
func readError[T](future: InternalRaisesFuture[T, void]): ref CatchableError {. ...raises: [ValueError], raises: [].}
- Source Edit
Macros
macro checkRaises[T: CatchableError](future: InternalRaisesFuture; raises: typed; error: ref T; warn: static bool = true): untyped {. ...raises: [].}
-
Generate code that checks that the given error is compatible with the raises restrictions of future.
This check is done either at compile time or runtime depending on the information available at compile time - in particular, if the raises inherit from error, we end up with the equivalent of a downcast which raises a Defect if it fails.
Source Edit
Templates
template init[T, E](F: type InternalRaisesFuture[T, E]; fromProc: static[string] = ""): F:type
-
Creates a new pending future.
Specifying fromProc, which is a string specifying the name of the proc that this future belongs to, is a good habit as it helps with debugging.
Source Edit template init[T, E](F: type InternalRaisesFuture[T, E]; fromProc: static[string] = ""; flags: static[FutureFlags]): F:type
-
Creates a new pending future.
Specifying fromProc, which is a string specifying the name of the proc that this future belongs to, is a good habit as it helps with debugging.
Source Edit