简体   繁体   中英

So, how to remove Rack::ShowExceptions from inside my rack app?

I write own little http app based on rack. And this code is to initialize rack. (This is not sinatra, not rails, not hanami app).

ENV['RACK_ENV']='deployment'
# some more initializations
# end then
@rack = Rack::Server.new(
    app: Router.new,
    Host: Cfg.http.host,
    Port: Cfg.http.port,
    Logger: Log,
    environment: Cfg.env.to_s
)

But if I crash my app I see in browser all that crap from Rack::ShowExceptions.

How can I completely disable, remove it, without need to patching rack sources?

@rack = Rack::Server.new(
    # ...
    environment: :none
)

I've open my eyes and found that in comments here https://github.com/rack/rack/blob/1.6.0/lib/rack/server.rb#L157-L162

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM