Skip to content

Commit

Permalink
Fix the logger
Browse files Browse the repository at this point in the history
Request.logger doesn't appear to be set sometimes in Rails, resulting
in "NoMethodError, no method 'error' for nil:nilclass"
  • Loading branch information
Daniel Berkompas committed Jun 3, 2013
1 parent b7ea036 commit b640a22
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/poncho/method.rb
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ def handle_exception!(error)
status error.respond_to?(:code) ? Integer(error.code) : 500

if server_error?
request.logger.error(
logger = (defined?(Rails)) ? Rails.logger : request.logger
logger.error(
"#{error.class}: #{error}\n\t" +
error.backtrace.join("\n\t")
)
Expand Down

0 comments on commit b640a22

Please sign in to comment.