Results for “error handling”
Small, practical examples. Search by task or narrow things down below.
Yield values on demand
Python: Use a generator to produce a sequence without storing all intermediate values.
Python✓ Tested
Safely read a caught error
Check the error type before accessing its message.
unknown✓ Tested
Handle a result with a discriminated union
Separate success data from an error message.
discriminated union✓ Tested
Capture output while handling a failed command
Bash Scripts: An assignment inherits the status of its command substitution, allowing both output and status to be handled.
Bash Scripts✓ Tested
Capture standard output and standard error separately
Bash Scripts: Use distinct redirections when diagnostic text should not be mixed with data.
Bash Scripts✓ Tested
Combine independent validation errors
Combine independent validation errors using a complete Go program with explicit sample inputs.
Go✓ Tested
Convert text without raising a conversion error
Return NULL when a numeric conversion fails.
TRY_CONVERT✓ Tested
Display a specific reactive validation error
Display a specific reactive validation error with a standalone Angular component and explicit browser behavior.
Angular✓ Tested
Distinguish end-of-input from other errors
Distinguish end-of-input from other errors using a complete Go program with explicit sample inputs.
Go✓ Tested
Handle an expected terminating error
PowerShell: Handle an expected terminating error using PowerShell 7.
PowerShell✓ Tested
Inspect a typed conversion error
Inspect a typed conversion error using a complete Go program with explicit sample inputs.
Go✓ Tested
Propagate a parsing error with question mark
Propagate a parsing error with question mark in a complete Rust program using the standard library.
Rust✓ Tested