Permalink
Browse files

bugfix: raise coherent error when variable not found

  • Loading branch information...
1 parent 40cb3f2 commit 342d5e299643fbcca3fd73bb89818bb72a26b60a @sinisterchipmunk committed Mar 23, 2012

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -18,6 +18,10 @@ describe "Simulator", ->
sim.enter "1234", false
expect(sim.state.variables.result.value).toEqual(9234)
+ it "should raise coherent errors when missing variables", ->
+ sim = simulate dom ""
+ expect(-> sim.find_variable "what").toThrow "Variable not defined: what"
+
describe "display output", ->
beforeEach ->
@@ -136,7 +136,7 @@ exports.Simulator = class Simulator
find_variable: (varname) ->
variable = @state.variables[varname] or= Builtins.descriptor_for(varname)
- throw new Error "Variable not defined: #{assign.attrs.name}" unless variable
+ throw new Error "Variable not defined: #{varname}" unless variable
variable
process_variable_assignments: ->

0 comments on commit 342d5e2

Please sign in to comment.