Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'doc/development/api_styleguide.md')
-rw-r--r--doc/development/api_styleguide.md11
1 files changed, 11 insertions, 0 deletions
diff --git a/doc/development/api_styleguide.md b/doc/development/api_styleguide.md
index 006d0a01abb..828ef21ba9a 100644
--- a/doc/development/api_styleguide.md
+++ b/doc/development/api_styleguide.md
@@ -333,6 +333,17 @@ expect(response).to match_response_schema('merge_requests')
Also see [verifying N+1 performance](#verifying-with-tests) in tests.
+## Error handling
+
+When throwing an error with a message that is meant to be user-facing, you should
+use the error message utility function contained in `lib/gitlab/utils/error_message.rb`.
+It adds a prefix to the error message, making it distinguishable from non-user-facing error messages.
+Please make sure that the Frontend is aware of the prefix usage and is using the according utils.
+
+```ruby
+Gitlab::Utils::ErrorMessage.to_user_facing('Example user-facing error-message')
+```
+
## Include a changelog entry
All client-facing changes **must** include a [changelog entry](changelog.md).