Skip to content

Email owner if invoice creation failed #74

@Sjors

Description

@Sjors

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    RailsRuby on Rails

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions