Sha256: 6115cb33e3b8f9b50dd5b0dceefe958ee627b820f14981ec0c78691f4fdc358a
Contents?: true
Size: 897 Bytes
Versions: 15
Compression:
Stored size: 897 Bytes
Contents
# encoding: utf-8 module Sinatra module ErrorHandler extend Hexacta def enable_errors p "Enabling errors..." ErrorHandler.setup_dir("/app/views/#{Hexacta::GEM_FILE_DIR}/errors") error_template(404) error_template(403) error_template(500) end def error_template(code) ErrorHandler.copy_file("/lib/sinatra/views/errors/#{code}.slim","/app/views/#{Hexacta::GEM_FILE_DIR}/errors/#{code}.slim") error code do if code == 500 title = env['sinatra.error'].message.split(':')[0].gsub('#<',''); message = (["in #{request.url}"] + env['sinatra.error'].backtrace).join(','); NotificationSender.instance.send_error(authenticated(User),title,message) end slim "#{Hexacta::GEM_FILE_DIR}/errors/#{code}".to_sym, locals: { :params => params } end end end register ErrorHandler end
Version data entries
15 entries across 15 versions & 1 rubygems