module Layer::Exceptions

Public Class Methods

build_exception(original_exception) click to toggle source
# File lib/layer/exceptions.rb, line 4
def self.build_exception(original_exception)
  identifier = JSON.parse(original_exception.http_body)['id']
  identifier.gsub!(/(?:_|(\/)|^)([a-z\d]*)/i) { $2.capitalize }

  exception = const_get(identifier) rescue Exception
  exception.new(original_exception)
rescue
  original_exception
end