module

Mangrullo::ErrorHandling

Error handling utilities

Class methods

docker_api_operation(operation : String, context : String | Nil = nil, &) : Result(Bool, String)

Wrap Docker API operations with consistent error handling

Source
docker_api_operation_typed(operation : String, context : String | Nil = nil, &)

Generic Docker API operation wrapper for operations that return specific types

Source
docker_api_operation_with_nil(operation : String, context : String | Nil = nil, &) : Result(Nil, String)

Wrap operations that might return nil, but still want error handling

Source
error(message : String, value = nil)

Create an error result

Source
error_message(result) : String | Nil

Extract error message from result

Source
failed?(result) : Bool

Check if a result failed

Source
http_operation(operation : String, context : String | Nil = nil, &) : Result(HTTP::Client::Response, String)

Wrap HTTP operations with consistent error handling

Source
log_and_return_error(operation : String, error : Exception, log_level : Log::Severity = Log::Severity::Error, context : String | Nil = nil) : Result(Nil, String)

Log an error with consistent format and return error result

Source
log_debug_and_return_error(operation : String, error : Exception, context : String | Nil = nil) : Result(Nil, String)

Log a debug message and return error result (for non-critical failures)

Source
sanitize_error_message(message : String | Nil) : String

Sanitize error messages to prevent malformed output

Source
success(value = nil)

Create a success result

Source
successful?(result) : Bool

Check if a result is successful

Source
value(result)

Extract value from result

Source