W3cubDocs

/Nim

errorhandling

Source Edit

This module contains support code for new-styled error handling via an nkError node kind.

Imports

ast, renderer, options, types

Types

ErrorKind = enum
  RawTypeMismatchError, ExpressionCannotBeCalled, CustomError,
  WrongNumberOfArguments, AmbiguousCall
expand as you need. Source Edit

Procs

proc errorSubNode(n: PNode): PNode {....raises: [], tags: [], forbids: [].}
Source Edit
proc errorToString(config: ConfigRef; n: PNode): string {.
    ...raises: [ValueError, Exception, KeyError, OSError],
    tags: [RootEffect, ReadDirEffect], forbids: [].}
Source Edit
proc newError(wrongNode: PNode; k: ErrorKind; args: varargs[PNode]): PNode {.
    ...raises: [], tags: [], forbids: [].}
Source Edit
proc newError(wrongNode: PNode; msg: string): PNode {....raises: [], tags: [],
    forbids: [].}
Source Edit

© 2006–2024 Andreas Rumpf
Licensed under the MIT License.
https://nim-lang.org/docs/compiler/errorhandling.html