Module: CommandTower::Workflows::Impersonation::ErrorMapping

Defined in:
app/workflows/command_tower/workflows/impersonation/error_mapping.rb

Class Method Summary collapse

Class Method Details

.http_status_for(error) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/workflows/command_tower/workflows/impersonation/error_mapping.rb', line 9

def http_status_for(error)
  case error
  when CommandTower::Errors::Auth::SelfImpersonationError,
       CommandTower::Errors::Auth::ImpersonationSessionMissingError,
       CommandTower::Errors::ValidationError
    :unprocessable_entity
  when CommandTower::Errors::Auth::NestedImpersonationError,
       CommandTower::Errors::ForbiddenError
    :forbidden
  when CommandTower::Errors::NotFoundError
    :not_found
  else
    :internal_server_error
  end
end