Sha256: f7beff343bed1bbb5122006332a4afe435e4c6cb1ed99a70b1d7a443429cf465

Contents?: true

Size: 777 Bytes

Versions: 2

Compression:

Stored size: 777 Bytes

Contents

module Moromi
  module Error
    module Rescue
      extend ActiveSupport::Concern

      included do
        rescue_from Moromi::Error::Default, with: -> (e) { render_bad_request(exception: e) }
        rescue_from Moromi::Error::ValidationError, with: -> (e) { render_bad_request(exception: e) }
        rescue_from Moromi::Error::NotFound, with: -> (e) { render_not_found(exception: e) }
        rescue_from Moromi::Error::PermissionDenied, with: -> (e) { render_forbidden(exception: e) }
        rescue_from Moromi::Error::AuthenticationFailed, with: -> (e) { render_unauthorized(exception: e) }
        rescue_from Moromi::Error::NeedForceUpdate, with: -> (e) { e.store_url = Moromi::Error.config.store_url; render_force_update(exception: e) }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
moromi-error-0.2.0 lib/moromi/error/rescue.rb
moromi-error-0.1.0 lib/moromi/error/rescue.rb