Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception handlers #25

Open
madleech opened this issue Aug 11, 2020 · 4 comments
Open

Exception handlers #25

madleech opened this issue Aug 11, 2020 · 4 comments

Comments

@madleech
Copy link
Collaborator

In Utopia::Exceptions::Handler the call function has rescue Exception => exception.
In Utopia::Exceptions::Mailer the call function has rescue => exception.

Why the difference? I found a case where incorrect ruby in a view would cause Handler to fire but not Mailer.

@ioquatix
Copy link
Member

Things that are not StandardError will not generate email. That is because these exceptions include out of memory, and other fatal errors. In such a case, we assume generating an email may be impossible. Can you explain what error was being generated?

@madleech
Copy link
Collaborator Author

With a view like foo.xnode:

<?r end ?>

Requesting /foo results in an exception being logged by Handler and the appropriate error page being shown, but Mailer doesn't trigger.

Backtrace:

	SyntaxError: /home/michael/Code/geozone/v1.geozone.co.nz/pages/foo.xnode:1: syntax error, unexpected end, expecting '}'
proc{|_out|; end 
             ^~~
		/home/michael/.rvm/gems/ruby-2.6.5/gems/trenni-3.9.0/lib/trenni/template.rb:128:in `eval'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/trenni-3.9.0/lib/trenni/template.rb:128:in `to_proc'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/trenni-3.9.0/lib/trenni/template.rb:110:in `freeze'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/trenni-3.9.0/lib/trenni/template.rb:98:in `load_file'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/utopia-2.12.4/lib/utopia/content.rb:81:in `block in fetch_template'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/concurrent-ruby-1.1.6/lib/concurrent-ruby/concurrent/map.rb:193:in `block in fetch_or_store'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/concurrent-ruby-1.1.6/lib/concurrent-ruby/concurrent/map.rb:172:in `fetch'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/concurrent-ruby-1.1.6/lib/concurrent-ruby/concurrent/map.rb:192:in `fetch_or_store'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/utopia-2.12.4/lib/utopia/content.rb:80:in `fetch_template'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/utopia-2.12.4/lib/utopia/content/node.rb:121:in `call'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/utopia-2.12.4/lib/utopia/content/document.rb:269:in `call'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/utopia-2.12.4/lib/utopia/content/document.rb:164:in `tag_end'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/utopia-2.12.4/lib/utopia/content/document.rb:187:in `render_node'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/utopia-2.12.4/lib/utopia/content/document.rb:67:in `render!'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/utopia-2.12.4/lib/utopia/content/document.rb:43:in `render'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/utopia-2.12.4/lib/utopia/content/node.rb:132:in `process!'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/utopia-2.12.4/lib/utopia/content.rb:128:in `call'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/utopia-2.12.4/lib/utopia/static.rb:104:in `call'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/utopia-2.12.4/lib/utopia/controller.rb:167:in `call'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/rack-cors-1.1.1/lib/rack/cors.rb:100:in `call'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/activerecord-rack-1.0.0/lib/active_record/rack/connection_management.rb:31:in `call'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/utopia-2.12.4/lib/utopia/session.rb:114:in `call'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/utopia-2.12.4/lib/utopia/redirection.rb:64:in `call'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/utopia-2.12.4/lib/utopia/redirection.rb:130:in `call'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/utopia-2.12.4/lib/utopia/redirection.rb:130:in `call'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/utopia-2.12.4/lib/utopia/redirection.rb:130:in `call'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/utopia-2.12.4/lib/utopia/redirection.rb:130:in `call'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/utopia-2.12.4/lib/utopia/redirection.rb:130:in `call'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/utopia-2.12.4/lib/utopia/redirection.rb:130:in `call'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/utopia-2.12.4/lib/utopia/static.rb:104:in `call'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/utopia-2.12.4/lib/utopia/exceptions/mailer.rb:69:in `call'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/utopia-2.12.4/lib/utopia/exceptions/handler.rb:60:in `call'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/falcon-0.36.4/lib/falcon/adapters/rack.rb:183:in `call'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/protocol-http-0.20.0/lib/protocol/http/middleware.rb:50:in `call'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/falcon-0.36.4/lib/falcon/adapters/rewindable.rb:63:in `call'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/protocol-http-0.20.0/lib/protocol/http/middleware.rb:50:in `call'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/protocol-http-0.20.0/lib/protocol/http/content_encoding.rb:46:in `call'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/protocol-http-0.20.0/lib/protocol/http/middleware.rb:50:in `call'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/async-http-cache-0.2.0/lib/async/http/cache/general.rb:130:in `call'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/protocol-http-0.20.0/lib/protocol/http/middleware.rb:50:in `call'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/async-http-0.52.4/lib/async/http/server.rb:64:in `block in accept'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/async-http-0.52.4/lib/async/http/protocol/http2/server.rb:74:in `block in each'
		/home/michael/.rvm/gems/ruby-2.6.5/gems/async-1.26.0/lib/async/task.rb:258:in `block in make_fiber'

@ioquatix
Copy link
Member

Maybe the SyntaxError should be caught explicitly since it doesn't represent a truely fatal error.

@madleech
Copy link
Collaborator Author

Yeah that makes sense, syntax errors are things that we should know about so they can be fixed :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants