Project

General

Profile

Actions

Bug #3004

closed

Inconsistent error behavior (JSON) when creating a new job

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

Status:
Resolved
Priority:
Normal
Assigned To:
-
Category:
-
Story points:
0.5
Actions #1

Updated by Ward Vandewege over 10 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"]
Actions #2

Updated by Ward Vandewege over 10 years ago

  • Story points set to 0.5
Actions #3

Updated by Ward Vandewege over 10 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
Actions #4

Updated by Ward Vandewege over 10 years ago

  • Status changed from New to Resolved
Actions

Also available in: Atom PDF