lib/jsonapionify/api/errors_object.rb in jsonapionify-0.9.0 vs lib/jsonapionify/api/errors_object.rb in jsonapionify-0.9.1

- old
+ new

@@ -31,18 +31,19 @@ @error[:source] ||= {} @error[:source][:parameter] = value end end - def evaluate(*args, error_block:, runtime_block:, backtrace: nil) - backtrace ||= caller - error = Structure::Objects::Error.new - evaluator = Evaluator.new(error) + def evaluate(*args, error_block:, runtime_block: nil, backtrace: nil) + backtrace ||= caller + runtime_block ||= proc {} + error = Structure::Objects::Error.new + evaluator = Evaluator.new(error) collection << error [runtime_block, error_block].each do |block| evaluator.instance_exec(*args, &block) if block end - unless ENV['RACK_ENV'] == 'production' + if JSONAPIonify.show_backtrace == true error[:meta] ||= {} error[:meta][:backtrace] = backtrace end end