Class: ForestAdminAgent::Http::ErrorTranslator
- Inherits:
-
Object
- Object
- ForestAdminAgent::Http::ErrorTranslator
- Defined in:
- lib/forest_admin_agent/http/error_translator.rb
Class Method Summary collapse
-
.translate(error) ⇒ HttpException
Translate any exception to its appropriate HTTP error representation.
Class Method Details
.translate(error) ⇒ HttpException
Translate any exception to its appropriate HTTP error representation
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/forest_admin_agent/http/error_translator.rb', line 10 def self.translate(error) return error if error.is_a?(Exceptions::HttpException) name = error.class.name.split('::').last status = get_error_status(error) = (error) data = get_error_data(error) custom_headers = get_custom_headers(error) Exceptions::HttpException.new( status, name, , data, custom_headers ) end |