Skip to content

Commit

Permalink
import api: add error message for missing parameters (#5256)
Browse files Browse the repository at this point in the history
**Story card:** 😶‍🌫️ 

## This addresses

We return a more descriptive error that pinpoints to the missing
top-level parameter rather than return a generic 404.
  • Loading branch information
tfidfwastaken authored Oct 16, 2023
1 parent 3c7765b commit 32a7840
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/controllers/api/v4/imports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ class Api::V4::ImportsController < ApplicationController
before_action :doorkeeper_authorize!
before_action :validate_token_organization

rescue_from ActionController::ParameterMissing do |error|
render json: {error: "Unable to find key in payload: \"#{error.param}\""}, status: :bad_request
end

def import
return head :not_found unless Flipper.enabled?(:imports_api)

Expand Down

0 comments on commit 32a7840

Please sign in to comment.