Skip to content

Commit

Permalink
Added a Meaningful error msg for control server port taken (#3204)
Browse files Browse the repository at this point in the history
* Caught Bind error and added a meaningfull erro mesaage

* removed comment

* rubocop lint fix

* cleanup

* raised std err

* Re-raised the actual error. Catching EADDRINUSE instead of Std err
  • Loading branch information
dhavalsingh committed Aug 25, 2023
1 parent 99da3a9 commit c2f7330
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/puma/runner.rb
Expand Up @@ -75,7 +75,11 @@ def start_control
control = Puma::Server.new app, nil,
{ min_threads: 0, max_threads: 1, queue_requests: false, log_writer: @log_writer }

control.binder.parse [str], nil, 'Starting control server'
begin
control.binder.parse [str], nil, 'Starting control server'
rescue Errno::EADDRINUSE, Errno::EACCES => e
raise e, "Error: Control server address '#{str}' is already in use. Original error: #{e.message}"
end

control.run thread_name: 'ctl'
@control = control
Expand Down

0 comments on commit c2f7330

Please sign in to comment.