mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -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 = {}
|
||||||
ctx[:opts] = opts
|
ctx[:opts] = opts
|
||||||
ctx[:job] = self.class
|
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.merge!(extra) if extra != nil
|
||||||
ctx
|
ctx
|
||||||
end
|
end
|
||||||
|
@ -157,7 +157,7 @@ module Jobs
|
||||||
end
|
end
|
||||||
rescue => e
|
rescue => e
|
||||||
thread_exception[:ex] = 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 }
|
thread_exception[:other] = { problem_db: db }
|
||||||
ensure
|
ensure
|
||||||
ActiveRecord::Base.connection_handler.clear_active_connections!
|
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)
|
client_message = RejectionMailer.send_rejection(message.from, message.body, message.to, message_template)
|
||||||
Email::Sender.new(client_message, message_template).send
|
Email::Sender.new(client_message, message_template).send
|
||||||
else
|
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
|
end
|
||||||
ensure
|
ensure
|
||||||
mail.delete
|
mail.delete
|
||||||
|
|
|
@ -33,7 +33,7 @@ if Sidekiq.server?
|
||||||
manager.tick
|
manager.tick
|
||||||
rescue => e
|
rescue => e
|
||||||
# the show must go on
|
# the show must go on
|
||||||
Discourse.handle_exception(e, {code: "Ticking scheduling manager"})
|
Discourse.handle_exception(e, {message: "While ticking scheduling manager"})
|
||||||
end
|
end
|
||||||
sleep 1
|
sleep 1
|
||||||
end
|
end
|
||||||
|
|
|
@ -128,7 +128,7 @@ module Oneboxer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rescue => e
|
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
|
# return a blank hash, so rest of the code works
|
||||||
{preview: "", onebox: ""}
|
{preview: "", onebox: ""}
|
||||||
end
|
end
|
||||||
|
|
|
@ -51,10 +51,10 @@ module Scheduler
|
||||||
RailsMultisite::ConnectionManagement.establish_connection(db: db)
|
RailsMultisite::ConnectionManagement.establish_connection(db: db)
|
||||||
job.call
|
job.call
|
||||||
rescue => ex
|
rescue => ex
|
||||||
Discourse.handle_exception(ex, {code: "Running deferred code '#{desc}'"})
|
Discourse.handle_exception(ex, {message: "Running deferred code '#{desc}'"})
|
||||||
end
|
end
|
||||||
rescue => ex
|
rescue => ex
|
||||||
Discourse.handle_exception(ex, {code: "Processing deferred code queue"})
|
Discourse.handle_exception(ex, {message: "Processing deferred code queue"})
|
||||||
ensure
|
ensure
|
||||||
ActiveRecord::Base.connection_handler.clear_active_connections!
|
ActiveRecord::Base.connection_handler.clear_active_connections!
|
||||||
end
|
end
|
||||||
|
|
|
@ -42,13 +42,13 @@ module Scheduler
|
||||||
def keep_alive
|
def keep_alive
|
||||||
@manager.keep_alive
|
@manager.keep_alive
|
||||||
rescue => ex
|
rescue => ex
|
||||||
Discourse.handle_exception(ex, {code: "Scheduling manager keep-alive"})
|
Discourse.handle_exception(ex, {message: "Scheduling manager keep-alive"})
|
||||||
end
|
end
|
||||||
|
|
||||||
def reschedule_orphans
|
def reschedule_orphans
|
||||||
@manager.reschedule_orphans!
|
@manager.reschedule_orphans!
|
||||||
rescue => ex
|
rescue => ex
|
||||||
Discourse.handle_exception(ex, {code: "Scheduling manager orphan rescheduler"})
|
Discourse.handle_exception(ex, {message: "Scheduling manager orphan rescheduler"})
|
||||||
end
|
end
|
||||||
|
|
||||||
def process_queue
|
def process_queue
|
||||||
|
@ -63,10 +63,10 @@ module Scheduler
|
||||||
@mutex.synchronize { info.write! }
|
@mutex.synchronize { info.write! }
|
||||||
klass.new.perform
|
klass.new.perform
|
||||||
rescue Jobs::HandledExceptionWrapper
|
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
|
failed = true
|
||||||
rescue => e
|
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
|
failed = true
|
||||||
end
|
end
|
||||||
duration = ((Time.now.to_f - start) * 1000).to_i
|
duration = ((Time.now.to_f - start) * 1000).to_i
|
||||||
|
@ -77,7 +77,7 @@ module Scheduler
|
||||||
@mutex.synchronize { info.write! }
|
@mutex.synchronize { info.write! }
|
||||||
end
|
end
|
||||||
rescue => ex
|
rescue => ex
|
||||||
Discourse.handle_exception(ex, {code: "Processing scheduled job queue"})
|
Discourse.handle_exception(ex, {message: "Processing scheduled job queue"})
|
||||||
ensure
|
ensure
|
||||||
@running = false
|
@running = false
|
||||||
end
|
end
|
||||||
|
|
|
@ -144,9 +144,9 @@ describe Discourse do
|
||||||
it "correctly passes extra context" do
|
it "correctly passes extra context" do
|
||||||
exception = StandardError.new
|
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.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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue