lib/wunderbar/script.rb in wunderbar-1.0.12 vs lib/wunderbar/script.rb in wunderbar-1.0.13

- old
+ new

@@ -56,16 +56,16 @@ headers = { 'type' => 'application/javascript', 'charset' => 'UTF-8' } begin output = Ruby2JS.convert(block) + "\n" rescue Parser::SyntaxError => exception - headers['status'] = "531 Internal Server Error" + headers['status'] = Wunderbar::ServerError.text location = exception.diagnostic.location output = "// Syntax Error: line #{location.line}, " + "column: #{location.column}\n#{exception}\n" rescue ::Exception => exception - headers['status'] = "531 Internal Server Error" + headers['status'] = Wunderbar::ServerError.text output = "// Internal Server Error: #{exception}\n" exception.backtrace.each do |frame| next if CALLERS_TO_IGNORE.any? {|re| frame =~ re} output += " #{frame}\n" end @@ -83,15 +83,15 @@ def evaluate(scope, locals, &block) scope.content_type self.class.default_mime_type, charset: 'utf-8' begin Ruby2JS.convert(block ? block : data, ivars: locals, file: file).to_s rescue Parser::SyntaxError => exception - scope.response.status = 531 + scope.response.status = Wunderbar::ServerError.status location = exception.diagnostic.location "Syntax Error: line #{location.line}, column: #{location.column}" + "\n#{exception}\n" rescue Exception => exception - scope.response.status = 531 + scope.response.status = Wunderbar::ServerError.status output = "Internal Server Error: #{exception}\n" exception.backtrace.each do |frame| next if CALLERS_TO_IGNORE.any? {|re| frame =~ re} output += " #{frame}\n" end