Skip to content

Commit

Permalink
Improve message for ProcessExitError exception
Browse files Browse the repository at this point in the history
To show as much information as possible.
  • Loading branch information
rosa committed Sep 2, 2024
1 parent 940c6ac commit 18dd153
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/solid_queue/processes/process_exit_error.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ module SolidQueue
module Processes
class ProcessExitError < RuntimeError
def initialize(status)
message = case
when status.exitstatus.present? then "Process pid=#{status.pid} exited with status #{status. exitstatus}"
when status.signaled? then "Process pid=#{status.pid} received unhandled signal #{status. termsig}"
else "Process pid=#{status.pid} exited unexpectedly"
message = "Process pid=#{status.pid} exited unexpectedly."
if status.exitstatus.present?
message += " Exited with status #{status.exitstatus}."
end

if status.signaled?
message += " Received unhandled signal #{status.termsig}."
end

super(message)
Expand Down

0 comments on commit 18dd153

Please sign in to comment.