fixing throwing an error string in the Rewriter, when it should have been an Error object
This commit is contained in:
parent
7de4caffca
commit
4d146bacb1
|
@ -8,7 +8,7 @@ get '/hello', ->
|
|||
# Append.
|
||||
append: (location, data) ->
|
||||
path: new Pathname location
|
||||
throw "Location does not exist" unless path.exists()
|
||||
throw new Error("Location does not exist") unless path.exists()
|
||||
|
||||
File.open path, 'a', (file) ->
|
||||
file.puts YAML.dump data
|
||||
|
|
|
@ -295,7 +295,7 @@
|
|||
levels[open] -= 1;
|
||||
}
|
||||
if (levels[open] < 0) {
|
||||
throw "too many " + token[1];
|
||||
throw new Error("too many " + token[1]);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
|
|
@ -199,7 +199,7 @@ re::ensure_balance: (pairs) ->
|
|||
levels[open] ||= 0
|
||||
levels[open] += 1 if token[0] is open
|
||||
levels[open] -= 1 if token[0] is close
|
||||
throw "too many " + token[1] if levels[open] < 0
|
||||
throw new Error("too many " + token[1]) if levels[open] < 0
|
||||
return 1
|
||||
unclosed: key for key, value of levels when value > 0
|
||||
throw new Error("unclosed " + unclosed[0]) if unclosed.length
|
||||
|
|
Loading…
Reference in New Issue