Exception handling.
parent
e1c204b742
commit
0e9d595a23
|
@ -273,6 +273,7 @@ authd_storage = "storage"
|
||||||
authd_jwt_key = "nico-nico-nii"
|
authd_jwt_key = "nico-nico-nii"
|
||||||
authd_registrations = false
|
authd_registrations = false
|
||||||
|
|
||||||
|
begin
|
||||||
OptionParser.parse do |parser|
|
OptionParser.parse do |parser|
|
||||||
parser.banner = "usage: authd [options]"
|
parser.banner = "usage: authd [options]"
|
||||||
|
|
||||||
|
@ -298,4 +299,12 @@ end
|
||||||
AuthD::Service.new(authd_storage, authd_jwt_key).tap do |authd|
|
AuthD::Service.new(authd_storage, authd_jwt_key).tap do |authd|
|
||||||
authd.registrations_allowed = authd_registrations
|
authd.registrations_allowed = authd_registrations
|
||||||
end.run
|
end.run
|
||||||
|
rescue e : OptionParser::Exception
|
||||||
|
STDERR.puts e.message
|
||||||
|
rescue e
|
||||||
|
STDERR.puts "exception raised: #{e.message}"
|
||||||
|
e.backtrace.try &.each do |line|
|
||||||
|
STDERR << " - " << line << '\n'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue