From ed464edabeb62e35363ebadd0a5bb5ff394b6781 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Tue, 30 Dec 2014 14:29:55 +0100 Subject: Message for api files and groups. --- lib/api/files.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/api/files.rb') diff --git a/lib/api/files.rb b/lib/api/files.rb index 84e1d311781..e6e71bac367 100644 --- a/lib/api/files.rb +++ b/lib/api/files.rb @@ -35,7 +35,7 @@ module API file_path = attrs.delete(:file_path) commit = user_project.repository.commit(ref) - not_found! "Commit" unless commit + not_found! 'Commit' unless commit blob = user_project.repository.blob_at(commit.sha, file_path) @@ -53,7 +53,7 @@ module API commit_id: commit.id, } else - render_api_error!('File not found', 404) + not_found! 'File' end end -- cgit v1.2.1 From 5f232b5687b447e7eac40f58c56628da22580de6 Mon Sep 17 00:00:00 2001 From: Vinnie Okada Date: Sun, 22 Feb 2015 16:01:49 -0700 Subject: Improve error messages when file editing fails Give more specific errors in API responses and web UI flash messages when a file update fails. --- lib/api/files.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/api/files.rb') diff --git a/lib/api/files.rb b/lib/api/files.rb index e6e71bac367..3176ef0e256 100644 --- a/lib/api/files.rb +++ b/lib/api/files.rb @@ -117,7 +117,8 @@ module API branch_name: branch_name } else - render_api_error!(result[:message], 400) + http_status = result[:http_status] || 400 + render_api_error!(result[:message], http_status) end end -- cgit v1.2.1