From 7240150c8986c7aa21d0eb3140ac9a4c7674a4d2 Mon Sep 17 00:00:00 2001
From: Marin Jankovski <maxlazio@gmail.com>
Date: Tue, 30 Dec 2014 15:17:46 +0100
Subject: [PATCH] Forward the messages in api response.

---
 lib/api/milestones.rb      | 4 ++--
 lib/api/notes.rb           | 2 +-
 lib/api/project_hooks.rb   | 4 ++--
 lib/api/project_members.rb | 2 +-
 lib/api/projects.rb        | 2 +-
 lib/api/repositories.rb    | 2 +-
 6 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/lib/api/milestones.rb b/lib/api/milestones.rb
index a4fdb752d6..4d79f5a69a 100644
--- a/lib/api/milestones.rb
+++ b/lib/api/milestones.rb
@@ -48,7 +48,7 @@ module API
         if milestone.valid?
           present milestone, with: Entities::Milestone
         else
-          not_found!
+          not_found!("Milestone #{milestone.errors.messages}")
         end
       end
 
@@ -72,7 +72,7 @@ module API
         if milestone.valid?
           present milestone, with: Entities::Milestone
         else
-          not_found!
+          not_found!("Milestone #{milestone.errors.messages}")
         end
       end
     end
diff --git a/lib/api/notes.rb b/lib/api/notes.rb
index b29c054a04..b04d623c69 100644
--- a/lib/api/notes.rb
+++ b/lib/api/notes.rb
@@ -61,7 +61,7 @@ module API
           if @note.valid?
             present @note, with: Entities::Note
           else
-            not_found!
+            not_found!("Note #{@note.errors.messages}")
           end
         end
 
diff --git a/lib/api/project_hooks.rb b/lib/api/project_hooks.rb
index 7d056b9bf5..be9850367b 100644
--- a/lib/api/project_hooks.rb
+++ b/lib/api/project_hooks.rb
@@ -53,7 +53,7 @@ module API
           if @hook.errors[:url].present?
             error!("Invalid url given", 422)
           end
-          not_found!
+          not_found!("Project hook #{@hook.errors.messages}")
         end
       end
 
@@ -82,7 +82,7 @@ module API
           if @hook.errors[:url].present?
             error!("Invalid url given", 422)
           end
-          not_found!
+          not_found!("Project hook #{@hook.errors.messages}")
         end
       end
 
diff --git a/lib/api/project_members.rb b/lib/api/project_members.rb
index 1595ed0bc3..8e32f124ea 100644
--- a/lib/api/project_members.rb
+++ b/lib/api/project_members.rb
@@ -9,7 +9,7 @@ module API
           if errors[:access_level].any?
             error!(errors[:access_level], 422)
           end
-          not_found!
+          not_found!(errors)
         end
       end
 
diff --git a/lib/api/projects.rb b/lib/api/projects.rb
index d6dd03656a..e1cc234886 100644
--- a/lib/api/projects.rb
+++ b/lib/api/projects.rb
@@ -227,7 +227,7 @@ module API
             render_api_error!("Project already forked", 409)
           end
         else
-          not_found!
+          not_found!("Source Project")
         end
 
       end
diff --git a/lib/api/repositories.rb b/lib/api/repositories.rb
index a1a7721b28..03a556a2c5 100644
--- a/lib/api/repositories.rb
+++ b/lib/api/repositories.rb
@@ -133,7 +133,7 @@ module API
           env['api.format'] = :binary
           present data
         else
-          not_found!
+          not_found!('File')
         end
       end
 
-- 
2.30.9