Module

_errors

Structured error hierarchy with format_compact() for terminal display.

Classes

ErrorCode 0
MiloError 2
Base error for all milo errors.

Base error for all milo errors.

Methods

format_compact 0 str
Format error for terminal display, consistent with kida's format_compact().
def format_compact(self) -> str
Returns
str
Internal Methods 1
__init__ 5
def __init__(self, code: ErrorCode, message: str, *, suggestion: str = '', context: dict[str, Any] | None = None, docs_url: str = '') -> None
Parameters
Name Type Description
code
message
suggestion Default:''
context Default:None
docs_url Default:''
InputError 0
Input-related errors (raw mode, escape parsing).

Input-related errors (raw mode, escape parsing).

StateError 0
State-related errors (reducer, dispatch, saga).

State-related errors (reducer, dispatch, saga).

FormError 0
Form-related errors (validation, field).

Form-related errors (validation, field).

AppError 0
App lifecycle errors.

App lifecycle errors.

FlowError 0
Flow errors (transitions, screens).

Flow errors (transitions, screens).

DevError 0
Dev server errors (watch, reload).

Dev server errors (watch, reload).

ConfigError 0
Configuration errors (parse, merge, validate).

Configuration errors (parse, merge, validate).

PipelineError 0
Pipeline orchestration errors (phase, timeout, dependency).

Pipeline orchestration errors (phase, timeout, dependency).

PluginError 0
Plugin system errors (load, hook).

Plugin system errors (load, hook).

Functions

format_error 1 str
Format any error for terminal display. Uses format_compact() for kida Template…
def format_error(error: Exception) -> str

Format any error for terminal display.

Uses format_compact() for kida TemplateErrors and MiloErrors. Falls back to str() for other exceptions.

Parameters
Name Type Description
error Exception
Returns
str
format_render_error 3 str
Format a render error with optional error template rendering. Tries to render …
def format_render_error(error: Exception, *, template_name: str = '', env: Any = None) -> str

Format a render error with optional error template rendering.

Tries to render through the built-in error.txt template. Falls back to format_error() if template rendering fails.

Parameters
Name Type Description
error Exception
template_name str Default:''
env Any Default:None
Returns
str
_get_error_code 1 str
Extract error code string from any error.
def _get_error_code(error: Exception) -> str
Parameters
Name Type Description
error Exception
Returns
str
_get_hint 1 str
Extract hint/suggestion from an error.
def _get_hint(error: Exception) -> str
Parameters
Name Type Description
error Exception
Returns
str
_get_docs_url 1 str
Extract docs URL from an error.
def _get_docs_url(error: Exception) -> str
Parameters
Name Type Description
error Exception
Returns
str