matreon icon indicating copy to clipboard operation
matreon copied to clipboard

Email owner if invoice creation failed

Open Sjors opened this issue 5 years ago • 0 comments

If invoice creation fails, e.g. because the lightning node crashed, it currently just sends an exception notification:

[Matreon Exception]  (Net::ReadTimeout) "Net::ReadTimeout"

A Net::ReadTimeout occurred in background at 2018-07-06 23:32:14 UTC :

Net::ReadTimeout
/app/vendor/ruby-2.4.2/lib/ruby/2.4.0/net/protocol.rb:176:in `rbuf_fill'
-------------------------------
Backtrace:
[...]
/app/app/models/invoice.rb:103:in `create_lightning_charge_invoice'
/app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:413:in `block in make_lambda'
[...]
/app/app/models/contribution.rb:41:in `create_or_update_invoice!'
/app/app/models/invoice.rb:38:in `block in generate!'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.6/lib/active_record/relation/delegation.rb:39:in `each'
/app/vendor/bundle/ruby/2.4.0/gems/activerecord-5.1.6/lib/active_record/relation/delegation.rb:39:in `each'
/app/app/models/invoice.rb:37:in `generate!'
/app/lib/tasks/invoices.rake:8:in `block (2 levels) in <top (required)>'
[...]

This is much too cryptic for such an important error. This exception should be caught instead and result in the owner receiving an email that invoice creation failed (and some info as to why).

Sjors avatar Jul 16 '18 09:07 Sjors