Function tvm::transform::EnrichPassErrorWithContext#
Defined in File transform.h
Function Documentation#
-
ffi::Error tvm::transform::EnrichPassErrorWithContext(const ffi::Error &err, const IRModule &mod, ffi::String pass_name, ffi::Optional<GlobalVar> func = ffi::Optional<GlobalVar>(std::nullopt))#
Enrich a pass-time error with a TVMScript-rendered, underlined source location derived from the error’s embedded VisitErrorContext.
Returns an ffi::Error that preserves err’s kind, original message, and backtrace, and appends the failing pass name plus the offending location rendered as TVMScript (the whole
mod, or local tofuncwhen provided). The returned error drops the VisitErrorContext payload, so an outer catch that re-enriches finds no context and returns the error unchanged.Pure and total: never throws; returns
errunchanged when there is no context, the path is unresolvable, or rendering fails.- Parameters:
err – The error thrown by the pass body.
mod – The IRModule the pass ran on (the access-path root, or the container of
funcwhenfuncis provided).pass_name – The name of the failing pass, shown in the message.
func – When set, resolve and render the location local to
mod->functions[func]; otherwise use the whole module.
- Returns:
The enriched (or, on any fallback, the original) error.