DNS.Result (DNS v0.5.0)
View SourceStandardized result types for DNS operations.
This module provides consistent error handling patterns throughout the DNS library, replacing the mix of throw/1 and {:error, reason} tuples with a unified approach.
Summary
Functions
Convert legacy throw-based functions to result-based functions.
Execute a function with a value, catching throws and converting to errors.
Get the error from a result or nil if successful.
Create a standardized error result.
Chain operations that return results.
Map over a successful result, leaving errors unchanged.
Wrap a successful result in the standard format.
Macro to wrap throw-based functions with result handling.
Extract the value from a result or return a default.
Types
Functions
Convert legacy throw-based functions to result-based functions.
Execute a function with a value, catching throws and converting to errors.
Get the error from a result or nil if successful.
Create a standardized error result.
Chain operations that return results.
Map over a successful result, leaving errors unchanged.
Wrap a successful result in the standard format.
Macro to wrap throw-based functions with result handling.
Extract the value from a result or return a default.