Class: DhanHQ::ErrorHandler
- Inherits:
-
Object
- Object
- DhanHQ::ErrorHandler
- Defined in:
- lib/DhanHQ/core/error_handler.rb
Overview
Provides a minimal shim for surfacing validation and runtime errors.
Class Method Summary collapse
-
.handle(error) ⇒ Object
Normalises the exception raised for various error types.
Class Method Details
.handle(error) ⇒ Object
Normalises the exception raised for various error types.
10 11 12 13 14 15 16 17 |
# File 'lib/DhanHQ/core/error_handler.rb', line 10 def self.handle(error) case error when Dry::Validation::Result raise DhanHQ::ValidationError, "Invalid parameters: #{error.errors.to_h}" else raise DhanHQ::Error, error. end end |