Skip to main content

Mojo function

error

error[T: Stringable](graph: Optional[Graph], message: T, location: Optional[_SourceLocation] = #kgen.none) -> Error

Creates an error to raise that includes call information.

This should be called internally at every point that can raise inside Graph API. By default, this only includes the specific call site of the raise. We hope to improve this in the future.

Parameters:

  • T (Stringable): The message type.

Args:

  • graph (Optional[Graph]): The graph for context information.
  • message (T): An error message to raise.
  • location (Optional[_SourceLocation]): An optional location for a more specific error message.

Returns:

The error message augmented with call context information.