mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 15:48:43 -05:00
Change 'code' to 'message'
This commit is contained in:
parent
a69efada85
commit
d90404e830
7 changed files with 14 additions and 14 deletions
|
@ -67,7 +67,7 @@ module Jobs
|
|||
ctx = {}
|
||||
ctx[:opts] = opts
|
||||
ctx[:job] = self.class
|
||||
ctx[:code] = code_desc if code_desc
|
||||
ctx[:message] = code_desc if code_desc
|
||||
ctx.merge!(extra) if extra != nil
|
||||
ctx
|
||||
end
|
||||
|
@ -157,7 +157,7 @@ module Jobs
|
|||
end
|
||||
rescue => e
|
||||
thread_exception[:ex] = e
|
||||
thread_exception[:code] = "establishing database connection to #{db}"
|
||||
thread_exception[:message] = "While establishing database connection to #{db}"
|
||||
thread_exception[:other] = { problem_db: db }
|
||||
ensure
|
||||
ActiveRecord::Base.connection_handler.clear_active_connections!
|
||||
|
|
|
@ -48,7 +48,7 @@ module Jobs
|
|||
client_message = RejectionMailer.send_rejection(message.from, message.body, message.to, message_template)
|
||||
Email::Sender.new(client_message, message_template).send
|
||||
else
|
||||
Discourse.handle_exception(e, error_context(@args, "unknown error when processing incoming email", mail: mail_string))
|
||||
Discourse.handle_exception(e, error_context(@args, "Unrecognized error type when processing incoming email", mail: mail_string))
|
||||
end
|
||||
ensure
|
||||
mail.delete
|
||||
|
|
|
@ -33,7 +33,7 @@ if Sidekiq.server?
|
|||
manager.tick
|
||||
rescue => e
|
||||
# the show must go on
|
||||
Discourse.handle_exception(e, {code: "Ticking scheduling manager"})
|
||||
Discourse.handle_exception(e, {message: "While ticking scheduling manager"})
|
||||
end
|
||||
sleep 1
|
||||
end
|
||||
|
|
|
@ -128,7 +128,7 @@ module Oneboxer
|
|||
}
|
||||
}
|
||||
rescue => e
|
||||
Discourse.handle_exception(e, url: url)
|
||||
Discourse.handle_exception(e, message: "While trying to onebox a URL", url: url)
|
||||
# return a blank hash, so rest of the code works
|
||||
{preview: "", onebox: ""}
|
||||
end
|
||||
|
|
|
@ -51,10 +51,10 @@ module Scheduler
|
|||
RailsMultisite::ConnectionManagement.establish_connection(db: db)
|
||||
job.call
|
||||
rescue => ex
|
||||
Discourse.handle_exception(ex, {code: "Running deferred code '#{desc}'"})
|
||||
Discourse.handle_exception(ex, {message: "Running deferred code '#{desc}'"})
|
||||
end
|
||||
rescue => ex
|
||||
Discourse.handle_exception(ex, {code: "Processing deferred code queue"})
|
||||
Discourse.handle_exception(ex, {message: "Processing deferred code queue"})
|
||||
ensure
|
||||
ActiveRecord::Base.connection_handler.clear_active_connections!
|
||||
end
|
||||
|
|
|
@ -42,13 +42,13 @@ module Scheduler
|
|||
def keep_alive
|
||||
@manager.keep_alive
|
||||
rescue => ex
|
||||
Discourse.handle_exception(ex, {code: "Scheduling manager keep-alive"})
|
||||
Discourse.handle_exception(ex, {message: "Scheduling manager keep-alive"})
|
||||
end
|
||||
|
||||
def reschedule_orphans
|
||||
@manager.reschedule_orphans!
|
||||
rescue => ex
|
||||
Discourse.handle_exception(ex, {code: "Scheduling manager orphan rescheduler"})
|
||||
Discourse.handle_exception(ex, {message: "Scheduling manager orphan rescheduler"})
|
||||
end
|
||||
|
||||
def process_queue
|
||||
|
@ -63,10 +63,10 @@ module Scheduler
|
|||
@mutex.synchronize { info.write! }
|
||||
klass.new.perform
|
||||
rescue Jobs::HandledExceptionWrapper
|
||||
# Discourse.handle_exception was already called
|
||||
# Discourse.handle_exception was already called, and we don't have any extra info to give
|
||||
failed = true
|
||||
rescue => e
|
||||
Discourse.handle_exception(e, {code: "Running a scheduled job", job: klass})
|
||||
Discourse.handle_exception(e, {message: "Running a scheduled job", job: klass})
|
||||
failed = true
|
||||
end
|
||||
duration = ((Time.now.to_f - start) * 1000).to_i
|
||||
|
@ -77,7 +77,7 @@ module Scheduler
|
|||
@mutex.synchronize { info.write! }
|
||||
end
|
||||
rescue => ex
|
||||
Discourse.handle_exception(ex, {code: "Processing scheduled job queue"})
|
||||
Discourse.handle_exception(ex, {message: "Processing scheduled job queue"})
|
||||
ensure
|
||||
@running = false
|
||||
end
|
||||
|
|
|
@ -144,9 +144,9 @@ describe Discourse do
|
|||
it "correctly passes extra context" do
|
||||
exception = StandardError.new
|
||||
|
||||
Discourse.handle_exception(exception, {code: "Doing a test", post_id: 31}, nil)
|
||||
Discourse.handle_exception(exception, {message: "Doing a test", post_id: 31}, nil)
|
||||
logger.exception.should == exception
|
||||
logger.context.keys.sort.should == [:current_db, :current_hostname, :code, :post_id].sort
|
||||
logger.context.keys.sort.should == [:current_db, :current_hostname, :message, :post_id].sort
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue