Skip to content

Commit 7385eab

Browse files
gramalingamCopilot
andauthored
Update docs/tutorial/rewriter/node_value_checkers.md
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 2ff4eb9 commit 7385eab

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/tutorial/rewriter/node_value_checkers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ Both check functions (including condition functions and node/value-level checker
183183
rewrite functions support the same conventions for indicating failure:
184184

185185
- **`MatchResult` with `.fail()`** *(recommended)*: Return `MatchResult().fail("reason", source)` to indicate failure with a descriptive reason and optional source node/value. This provides the most useful diagnostic information for debugging.
186-
- **Raise `MatchFailureError`** *(recommended)*: Raise `MatchFailureError("reason", source_node_or_value)` to indicate failure. This is especially convenient in utility functions called from a check or rewrite, since it avoids having to explicitly propagate failure status through the call chain.
186+
- **Raise `MatchFailureError`** *(recommended)*: Import it as `from onnxscript.rewriter.rewriter import MatchFailureError` and raise `MatchFailureError("reason", source1, source2, ...)` to indicate failure associated with one or more `ir.Node` or `ir.Value` objects. Each source should be passed as a separate positional argument (do not pass a list as a single argument). This is especially convenient in utility functions called from a check or rewrite, since it avoids having to explicitly propagate failure status through the call chain.
187187
- **Return `None` or `False`**: These indicate failure without providing a reason. They are supported but not recommended, since a failure reason is valuable for debugging why a rule did not apply.
188188

189189
Including a descriptive failure reason is strongly encouraged. The rewriter's tracing infrastructure

0 commit comments

Comments
 (0)