Results for “Error”
Small, practical examples. Search by task or narrow things down below.
Handle a result with a discriminated union
Separate success data from an error message.
discriminated union✓ Tested
Handle an asynchronous failure
Handle an asynchronous failure with a small React component and explicit browser behavior.
React✓ Tested
Handle an expected child-process failure
Python: Catch CalledProcessError when check=True reports a nonzero exit status.
Python✓ Tested
Handle an unsuccessful HTTP status
jQuery: fail receives the jqXHR object and exposes its status.
jQuery✓ Tested
Handle integer overflow without panicking
Handle integer overflow without panicking in a complete Rust program using the standard library.
Rust✓ Tested
Handle malformed JSON
C#: Catch JsonException for malformed JSON without swallowing unrelated failures.
C#✓ Tested
Handle malformed JSON input
Python: Catch JSONDecodeError without hiding unrelated programming errors.
Python✓ Tested
Keep an optional value only when valid
Keep an optional value only when valid in a complete Rust program using the standard library.
Rust✓ Tested
Observe an exception from an asynchronous task
C++: Calling get rethrows an exception captured by the future.
C++✓ Tested
Parse a Boolean configuration value
Parse a Boolean configuration value using a complete Go program with explicit sample inputs.
Go✓ Tested
Parse a typed command-line option
Python: Use argparse to validate and convert an integer option.
Python✓ Tested
Parse an email address syntax
Parse an email address syntax using a complete Go program with explicit sample inputs.
Go✓ Tested