Skip to content

Commit

Permalink
add unhandled_exception_before_exit event callback for ruby
Browse files Browse the repository at this point in the history
  • Loading branch information
jtomson authored and CamJN committed Apr 28, 2023
1 parent 8b70688 commit 213c9a0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/ruby_supportlib/phusion_passenger/public_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class << self
@@event_credentials = []
@@event_after_installing_signal_handlers = []
@@event_oob_work = []
@@event_unhandled_exception_before_exit = []
@@advertised_concurrency_level = nil

def on_event(name, &block)
Expand Down Expand Up @@ -69,6 +70,8 @@ def callback_list_for_event(name)
@@event_after_installing_signal_handlers
when :oob_work
@@event_oob_work
when :unhandled_exception_before_exit
@@event_unhandled_exception_before_exit
else
raise ArgumentError, "Unknown event name '#{name}'"
end
Expand Down
1 change: 1 addition & 0 deletions src/ruby_supportlib/phusion_passenger/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ def create_thread_and_abort_on_exception(*args)
raise
rescue Exception => e
print_exception(nil, e)
PhusionPassenger.call_event(:unhandled_exception_before_exit, e)
exit(1)
end
end
Expand Down

0 comments on commit 213c9a0

Please sign in to comment.