Error Handler
1 Error Handler
This reference is curated against the current app/logic/error_handler.R implementation. Only functions that are explicitly exported should be treated as stable API.
1.1 Overview
The error_handler.R module provides consistent error, warning, and success notifications.
Location: app/logic/error_handler.R
1.2 Key Functions
1.2.1 show_error()
Displays error notification to user.
Parameters: - session (shiny session): Shiny session object - title (character): Short title shown in bold - message (character): Error message - details (character|NULL): Optional detail string appended in smaller text
Returns: None (side effect: shows notification)
1.2.2 show_warning()
Displays warning notification to user.
Parameters: - session (shiny session): Shiny session object - title (character): Short title shown in bold - message (character): Warning message
Returns: None
1.2.3 show_success()
Displays success notification to user.
Parameters: - session (shiny session): Shiny session object - title (character): Short title shown in bold - message (character): Success message
1.2.4 load_with_fallback()
Attempts to validate and load a file; returns a structured result on success or failure.
Parameters: - file_path (character): Path to the file - file_type (character): Type label (e.g., "gds", "sv", "cnv") - validation_fn (function): Validator returning list(is_valid, message) - load_fn (function): Loader called iff validation passes - fallback_value (any): Value returned in $data on failure (default: NULL)
Returns: list(success, data, error, file_type)
Returns: None
1.3 Usage
box::use(
app/logic/error_handler[show_error, show_warning, show_success]
)
# In module server function
if (!isTRUE(validate_gds_file(path)$is_valid)) {
show_error(session, "Invalid GDS file format", "Validation failed")
return(NULL)
}
show_success(session, "Loaded", "Data loaded successfully")1.4 Notification Styling
Notifications are implemented via shiny::showNotification() and formatted using shiny::HTML().