Improve error message reported to end user

This commit is contained in:
Vitalii Elenhaupt 2023-02-19 14:44:29 +02:00
parent 63a54986dd
commit be8862837f
No known key found for this signature in database
GPG Key ID: CD0BF17825928BC0
2 changed files with 2 additions and 2 deletions

View File

@ -34,7 +34,7 @@ module Ameba
end
it "raises when name is incorrect" do
expect_raises(Exception, "Incorrect severity name BadName. Try one of available names") do
expect_raises(Exception, "Incorrect severity name BadName. Try one of Error, Warning, Convention") do
Severity.parse("BadName")
end
end

View File

@ -41,7 +41,7 @@ module Ameba
def self.parse(name : String)
super name
rescue ArgumentError
raise "Incorrect severity name #{name}. Try one of available names"
raise "Incorrect severity name #{name}. Try one of #{values.map(&.to_s).join(", ")}"
end
end