FIND YOUR NEXT FEW LINES

Results for “exception”

Small, practical examples. Search by task or narrow things down below.

17 snippets foundClear filters
C++Tasks & synchronization

Observe an exception from an asynchronous task

C++: Calling get rethrows an exception captured by the future.

C++✓ Tested
C++Numeric parsing & calculations

Parse a complete integer without exceptions

C++: from_chars reports both an error code and the first unconsumed character.

C++✓ Tested
C#Asynchronous work & URI handling

Parse a GUID without an exception

C#: TryParse reports malformed values with a boolean return.

C#✓ Tested
C#Types & reliable control flow

Perform cleanup even after an exception

C#: A finally block runs after a handled failure as well as after success.

C#✓ Tested
PythonFunctions & error handling

Raise and catch a domain-specific exception

Python: Give a validation failure its own exception type so callers can handle it narrowly.

Python✓ Tested
PowerShellFunctions & parameter validation

Run cleanup after a caught exception

PowerShell: Use finally for cleanup that must occur after either success or failure.

PowerShell✓ Tested
JavaRecords & reliable control flow

Run cleanup after a handled exception

Java: A finally block executes whether the protected operation succeeds or fails.

Java✓ Tested
PowerShellFunctions & control

Handle a terminating error

Catch conversion failures and produce a clear fallback.

try catch✓ Tested
PythonFile operations & archives

Clean up a temporary directory automatically

Python: Use TemporaryDirectory as a context manager so cleanup also happens after exceptions.

Python✓ Tested
C#JSON & binary formats

Handle malformed JSON

C#: Catch JsonException for malformed JSON without swallowing unrelated failures.

C#✓ Tested
C#Asynchronous work & URI handling

Limit concurrent access with SemaphoreSlim

C#: Release the semaphore in finally so exceptions cannot leave it permanently acquired.

C#✓ Tested
JavaNumbers & dates

Parse an integer safely

Handle invalid Java integer input with NumberFormatException.

Java✓ Tested