@groovy.util.logging.Slf4j @groovy.transform.CompileStatic class BidsErrorHandler extends java.lang.Object
Context-aware error-handling utilities for nf-bids processing.
Provides tryWithContext (re-throw with context), safeExecute (return a default on failure), and validateWithContext (assert with context-labelled exception). Also contains three typed exception sub-classes: BidsProcessingException, BidsValidationException, and BidsConfigurationException.
| Modifiers | Name | Description |
|---|---|---|
static class |
BidsErrorHandler.BidsConfigurationException |
Custom exception for BIDS configuration errors |
static class |
BidsErrorHandler.BidsProcessingException |
Custom exception for BIDS-specific errors |
static class |
BidsErrorHandler.BidsValidationException |
Custom exception for BIDS validation errors |
| Constructor and description |
|---|
BidsErrorHandler() |
| Type Params | Return Type | Name and description |
|---|---|---|
|
static java.lang.String |
createDetailedError(java.lang.String error, java.util.List<java.lang.String> suggestions)Create detailed error message with suggestions |
|
static void |
handleError(java.lang.String context, java.lang.Exception e)Handle error with context |
|
static void |
handleErrorWithMessage(java.lang.String context, java.lang.String message)Handle error with custom message |
|
static void |
handleWarning(java.lang.String context, java.lang.String message)Handle warning with context |
<T> |
static T |
safeExecute(java.lang.String context, groovy.lang.Closure<T> closure, T defaultValue)Execute code block safely with default value on failure |
<T> |
static T |
tryWithContext(java.lang.String context, groovy.lang.Closure<T> closure)Execute code block with error context |
|
static void |
validateWithContext(boolean condition, java.lang.String context, java.lang.String message)Validate condition with context |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait() |
Create detailed error message with suggestions
error - Main error messagesuggestions - List of suggestions to resolveHandle error with context
context - Error contexte - Exception that occurredHandle error with custom message
context - Error contextmessage - Error messageHandle warning with context
context - Warning contextmessage - Warning messageExecute code block safely with default value on failure
context - Error context identifierclosure - Code to executedefaultValue - Value to return on failureExecute code block with error context Wraps execution with context information for better error messages
context - Error context identifierclosure - Code to executeValidate condition with context
condition - Condition to validatecontext - Error contextmessage - Error message if condition fails