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:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-11-27 16:34:05 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-11-27 16:34:05 +0300
commit37add27a00d38e4edaaec945ed9f44a123523884 (patch)
tree4d034575e8c6ee6019125ed820309989c25106ea /lib/gitlab/utils.rb
parent3dfbfa4e4f2ce962660dc534ac7a8c670049b506 (diff)
Improve token authenticable tests and exceptions
Diffstat (limited to 'lib/gitlab/utils.rb')
-rw-r--r--lib/gitlab/utils.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/gitlab/utils.rb b/lib/gitlab/utils.rb
index 41ed1dc5605..96d2ed88b83 100644
--- a/lib/gitlab/utils.rb
+++ b/lib/gitlab/utils.rb
@@ -17,7 +17,8 @@ module Gitlab
end
def ensure_utf8_size(str, bytes:)
- raise ArgumentError if str.empty? || bytes.negative?
+ raise ArgumentError, 'Empty string provided!' if str.empty?
+ raise ArgumentError, 'Negative string size provided!' if bytes.negative?
truncated = str.each_char.each_with_object(+'') do |char, object|
if object.bytesize + char.bytesize > bytes