IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /docs/manual/basics.md). For the complete Mojo documentation index, see llms.txt.
Skip to main content
Version: Nightly
For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).

ExceptionType

struct ExceptionType

A CPython global exception type used to translate a Mojo Error into a Python exception.

Fields

  • global_name (StaticString): The name of the backing CPython global, for example PyExc_TypeError.

Implemented traits

AnyType, Copyable, ImplicitlyCopyable, ImplicitlyDeletable, Movable, RegisterPassable, TrivialRegisterPassable

comptime members

Exception

comptime Exception = ExceptionType(StringSlice("PyExc_Exception"))

The base Exception type.

TypeError

comptime TypeError = ExceptionType(StringSlice("PyExc_TypeError"))

The TypeError type.

ValueError

comptime ValueError = ExceptionType(StringSlice("PyExc_ValueError"))

The ValueError type.