Actions
Refactor #3627
openRemove rescue blocks from actions and use error handler
Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Description
We use rescue blocks in actions like here
post "/dns/" do
fqdn = params[:fqdn]
value = params[:value]
type = params[:type]
begin
dns_setup({:fqdn => fqdn, :value => value, :type => type})
@server.create
rescue Proxy::DNS::Collision => e
log_halt 409, e
rescue Exception => e
log_halt 400, e
end
end
Instead we should use error handler http://www.sinatrarb.com/intro.html#Error%20Handling at least for specific exceptions to be more DRY. We should add custom exceptions where needed.
No data to display
Actions