Bug #3004

Inconsistent error behavior (JSON) when creating a new job

Added by Ward Vandewege over 6 years ago. Updated over 6 years ago.

Status:
Resolved
Priority:
Normal
Assigned To:
-
Category:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Story points:
0.5

Associated revisions

Revision 23fd8b13 (diff)
Added by Ward Vandewege over 6 years ago

Fix inconsistent JSON error return behavior on job create.

refs #3004

History

#1 Updated by Ward Vandewege over 6 years ago

  • Subject changed from Inconsistent error behavior (JSON) when creating a new job to Inconsistent error behavior (JSON) when creating a new job / #<ArgumentError: Specified script_version does not resolve to a commit>

ensure_script_version_is_commit in app/models/job.rb raises an ArgumentError if the specified script_version does not resolve to a commit.

render_errors in app/controllers/application_controller.rb reduces that to a JSON response:

render json: { errors: errors }, status: status

This returns a JSON with key 'errors', value an array.

create in app/controllers/arvados/v1/jobs_controller.rb has this bit of code:

    [:repository, :script, :script_version, :script_parameters].each do |r|
      if !resource_attrs[r]
        return render json: {
          :error => "#{r} attribute must be specified" 
        }, status: :unprocessable_entity
      end
    end

That returns a JSON with key 'error', and value a string.

arv-run-pipeline-instance tests for the key 'errors', not 'error'.

I suggest the latter is converted to

:errors => ["#{r} attribute must be specified"]

#2 Updated by Ward Vandewege over 6 years ago

  • Story points set to 0.5

#3 Updated by Ward Vandewege over 6 years ago

  • Subject changed from Inconsistent error behavior (JSON) when creating a new job / #<ArgumentError: Specified script_version does not resolve to a commit> to Inconsistent error behavior (JSON) when creating a new job

#4 Updated by Ward Vandewege over 6 years ago

  • Status changed from New to Resolved

Also available in: Atom PDF