|
|
|
@ -66,6 +66,7 @@ module API |
|
|
|
|
|
|
|
|
|
def default_error_response(headers, log) |
|
|
|
|
lambda { |e| |
|
|
|
|
original_exception = $! |
|
|
|
|
representer = ::API::V3::Errors::ErrorRepresenter.new e |
|
|
|
|
resp_headers = instance_exec &headers |
|
|
|
|
env['api.format'] = 'hal+json' |
|
|
|
@ -74,16 +75,20 @@ module API |
|
|
|
|
message = <<-MESSAGE |
|
|
|
|
Grape rescuing from error: #{e} |
|
|
|
|
|
|
|
|
|
Original error: #{$!.inspect} |
|
|
|
|
Original error: #{original_exception.inspect} |
|
|
|
|
|
|
|
|
|
Stacktrace: |
|
|
|
|
MESSAGE |
|
|
|
|
|
|
|
|
|
$@.each do |line| |
|
|
|
|
OpenProject.logger.clean_backtrace(original_exception).each do |line| |
|
|
|
|
message << "\n #{line}" |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
Rails.logger.error message |
|
|
|
|
OpenProject.logger.error( |
|
|
|
|
message, |
|
|
|
|
exception: original_exception, |
|
|
|
|
reference: :APIv3 |
|
|
|
|
) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
error_response status: e.code, message: representer.to_json, headers: resp_headers |
|
|
|
|