diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2017-06-06 20:23:19 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2017-06-06 21:19:07 +0800 |
commit | e86e1e515a7a4e4e1ee53d3d33bdfebfddd226a6 (patch) | |
tree | 42b4d18a02ca2307dcbc6c0a262904ee3427c0fa /lib/api | |
parent | 9984f07a28273035d6c989913cb76c9c371965d0 (diff) | |
download | gitlab-ce-e86e1e515a7a4e4e1ee53d3d33bdfebfddd226a6.tar.gz |
Try to report why it's failing and fix tests
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/triggers.rb | 9 | ||||
-rw-r--r-- | lib/api/v3/triggers.rb | 7 |
2 files changed, 9 insertions, 7 deletions
diff --git a/lib/api/triggers.rb b/lib/api/triggers.rb index a9f2ca2608e..9e444563fdf 100644 --- a/lib/api/triggers.rb +++ b/lib/api/triggers.rb @@ -28,11 +28,12 @@ module API # create request and trigger builds trigger_request = Ci::CreateTriggerRequestService.new.execute(project, trigger, params[:ref].to_s, variables) - if trigger_request - present trigger_request.pipeline, with: Entities::Pipeline + pipeline = trigger_request.pipeline + + if pipeline.persisted? + present pipeline, with: Entities::Pipeline else - errors = 'No pipeline created' - render_api_error!(errors, 400) + render_validation_error!(pipeline) end end diff --git a/lib/api/v3/triggers.rb b/lib/api/v3/triggers.rb index a23d6b6b48c..7e75c579528 100644 --- a/lib/api/v3/triggers.rb +++ b/lib/api/v3/triggers.rb @@ -29,11 +29,12 @@ module API # create request and trigger builds trigger_request = Ci::CreateTriggerRequestService.new.execute(project, trigger, params[:ref].to_s, variables) - if trigger_request + pipeline = trigger_request.pipeline + + if pipeline.persisted? present trigger_request, with: ::API::V3::Entities::TriggerRequest else - errors = 'No builds created' - render_api_error!(errors, 400) + render_validation_error!(pipeline) end end |