core: Show error message if _key dynamically passed into error [GH-2328]

This commit is contained in:
Mitchell Hashimoto 2013-10-05 09:21:38 -07:00
parent bf70fba936
commit 225da651f8
3 changed files with 12 additions and 1 deletions

View File

@ -1,6 +1,9 @@
## 1.3.5 (unreleased)
BUG FIXES:
- core: Fix some places where "no error message" errors were being
reported when in fact there were errors. [GH-2328]
## 1.3.4 (October 2, 2013)

View File

@ -60,7 +60,7 @@ module Vagrant
message = { :_key => message } if message && !message.is_a?(Hash)
message = { :_key => error_key, :_namespace => error_namespace }.merge(message || {})
if error_key
if message[:_key]
message = translate_error(message)
else
message = error_message

View File

@ -17,6 +17,14 @@ describe Vagrant::Errors::VagrantError do
its("status_code") { should eq(1) }
end
describe "passing error key through options" do
subject { described_class.new(_key: "test_key") }
it "should use the translation for the message" do
subject.to_s.should == "test value"
end
end
describe "subclass with error message" do
let(:klass) do
Class.new(described_class) do