lib/faastruby/server/runner.rb in faastruby-0.5.23 vs lib/faastruby/server/runner.rb in faastruby-0.5.24

- old
+ new

@@ -71,9 +71,17 @@ function = load_function("#{@function_folder}/handler.rb") function_object.extend(function) response = function_object.handler(event, *args) || function_object.render_nothing response = FaaStRuby::Response.invalid_response unless response.is_a?(FaaStRuby::Response) rescue Exception => e + if e.class == SyntaxError + line, *m = e.message.split(' ') + line_no = line.split(':')[1] + real_no = line_no.to_i - 13 + STDOUT.puts "handler.rb:#{real_no}: #{m.join(' ')}" + else + STDOUT.puts e.full_message + end error = Oj.dump({ 'error' => e.message, 'location' => e.backtrace&.first }) response = FaaStRuby::Response.error(error) \ No newline at end of file