Exception: Takagi::Errors::ServerError
Overview
Raised when application/server lifecycle fails
Instance Attribute Summary
Attributes inherited from TakagiError
#context, #suggestions
Class Method Summary
collapse
Methods inherited from TakagiError
#initialize
Class Method Details
.already_running(server_info) ⇒ Object
389
390
391
392
393
394
395
396
397
398
399
400
401
402
|
# File 'lib/takagi/errors.rb', line 389
def self.already_running(server_info)
new(
"Server is already running",
context: {
port: server_info[:port],
protocols: server_info[:protocols],
pid: Process.pid
},
suggestions: [
"Call shutdown! before starting again",
"Or use different port: run!(port: #{server_info[:port] + 1})"
]
)
end
|
.no_controllers_loaded ⇒ Object
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
|
# File 'lib/takagi/errors.rb', line 419
def self.no_controllers_loaded
new(
"No controllers loaded in application",
context: {
controllers_loaded: 0
},
suggestions: [
"Define at least one controller:",
" class MyController < Takagi::Controller",
" get '/test' do; end",
" end",
"Then load it:",
" class MyApp < Takagi::Application",
" configure { load_controllers MyController }",
" end"
]
)
end
|
.port_in_use(port, protocol) ⇒ Object
404
405
406
407
408
409
410
411
412
413
414
415
416
417
|
# File 'lib/takagi/errors.rb', line 404
def self.port_in_use(port, protocol)
new(
"Port #{port} is already in use",
context: {
port: port,
protocol: protocol
},
suggestions: [
"Use a different port: run!(port: #{port + 1})",
"Stop the process using port #{port}",
"Check with: lsof -i :#{port}"
]
)
end
|