diff options
author | Stan Hu <stanhu@gmail.com> | 2015-12-02 03:15:01 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2015-12-04 18:13:28 +0300 |
commit | a120b78940b6c7150f405091d620b34c0fccbd28 (patch) | |
tree | f6463868c2b4faebbae0e6dd738364ebc6c1088f /app/controllers/projects/hooks_controller.rb | |
parent | 238ca3e472a67d319521daa5aeab6455b4740cdb (diff) |
Handle and report SSL errors in Web hook test. Check for status 200 for success.
If a Web hook test fails due to an SSL error or some other error, report
the result back to the user instead of an Error 500.
Closes #3656
Handle response
Diffstat (limited to 'app/controllers/projects/hooks_controller.rb')
-rw-r--r-- | app/controllers/projects/hooks_controller.rb | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/app/controllers/projects/hooks_controller.rb b/app/controllers/projects/hooks_controller.rb index c7569541899..6a62880cb71 100644 --- a/app/controllers/projects/hooks_controller.rb +++ b/app/controllers/projects/hooks_controller.rb @@ -25,13 +25,12 @@ class Projects::HooksController < Projects::ApplicationController def test if !@project.empty_repo? - status = TestHookService.new.execute(hook, current_user) + status, message = TestHookService.new.execute(hook, current_user) if status flash[:notice] = 'Hook successfully executed.' else - flash[:alert] = 'Hook execution failed. '\ - 'Ensure hook URL is correct and service is up.' + flash[:alert] = "Hook execution failed: #{message}" end else flash[:alert] = 'Hook execution failed. Ensure the project has commits.' |