diff --git a/app/controllers/projects/hooks_controller.rb b/app/controllers/projects/hooks_controller.rb
index 366373b0f0a5a49417ded9600193709e4c69fb3d..9869d90831c4f6878a716c2b03e5f26feb1b92d5 100644
--- a/app/controllers/projects/hooks_controller.rb
+++ b/app/controllers/projects/hooks_controller.rb
@@ -27,8 +27,10 @@ class Projects::HooksController < Projects::ApplicationController
     if !@project.empty_repo?
       status, message = TestHookService.new.execute(hook, current_user)
 
-      if status
-        flash[:notice] = "Hook successfully executed, HTTP #{status} #{message}"
+      if status && status >= 200 && status < 400
+        flash[:notice] = "Hook executed successfully"
+      elsif status
+        flash[:alert] = "Hook executed successfully but returned HTTP #{status} #{message}"
       else
         flash[:alert] = "Hook execution failed: #{message}"
       end