lib/ditty/helpers/authentication.rb in ditty-0.10.2 vs lib/ditty/helpers/authentication.rb in ditty-0.11.1
- old
+ new
@@ -7,9 +7,13 @@
module Authentication
def current_user
return nil if current_user_id.nil?
@current_user ||= User[current_user_id]
+ rescue Sequel::DatabaseError => e
+ Services::Logger.warn "Could not fetch current user: #{e.message} / #{current_user_id}"
+ Services::Logger.debug e
+ nil
end
def current_user=(user)
env['rack.session'] = {} if env['rack.session'].nil?
env['rack.session']['user_id'] = user.id if user