On this page

Understand errors and refusals๏ƒ

An error message is part of the public interaction. Start by identifying which operation failed: registration, graph compilation, resolution, or cleanup. Then compare its inputs and setup with the smallest relevant saved example.

A useful debugging sequence๏ƒ

  1. Keep the original exception type and message.

  2. Identify the operation and the spell address involved.

  3. Reduce the problem to the registrations and scope needed to reproduce it.

  4. Check the source example's setup order and assertions.

  5. Fix the invalid input or lifecycle assumption before adding a fallback.

The error-vocabulary lesson demonstrates a missing resolution target and the public exception vocabulary. The double-bind lesson isolates registration behavior. The reading-errors lesson focuses on interpreting a refusal.

These examples intentionally exercise failures. A caught refusal can be the expected outcome of a lesson; it is different from silently ignoring an error in application code.

The workflow in code๏ƒ

These are the core steps from the saved example. Use its complete linked script for all class definitions and setup.

 1def main() -> None:
 2    book = md.Spellbook()
 3    book.bind(spell=Registered, existence=md.Existence.unique)
 4    conduit = book.conjure()
 5
 6    try:
 7        conduit.meld("NeverRegistered")
 8    except KeyError as err:
 9        # the documented "not found anywhere" contract is one stable KeyError
10        print("unregistered spell -> KeyError:", err)
11
12    # the full catchable family, importable without knowing ANY internal path
13    family = [
14        md.SpellbookValidationError, md.MeldExecutionError,
15        md.SpellSpaceScopeError, md.HookExecutionError,
16        md.InternalRegistrationError, md.PhaseSchedulerError,
17        md.PhaseExecutionError, md.PhaseTimeoutError, md.DeadReferenceError,
18    ]
19    assert all(issubclass(e, BaseException) for e in family)
20    print("error vocabulary size:", len(family))

Runnable examples๏ƒ

All beginner examples ยท Level contents ยท Full contents

Canonical page source