Report lndhub errors to Sentry
This commit is contained in:
parent
7000908891
commit
82019f47be
@ -37,8 +37,8 @@ class Services::LightningController < ApplicationController
|
|||||||
session[:ln_auth_token] = auth_token
|
session[:ln_auth_token] = auth_token
|
||||||
@ln_auth_token = auth_token
|
@ln_auth_token = auth_token
|
||||||
end
|
end
|
||||||
rescue
|
rescue => e
|
||||||
# TODO add exception tracking
|
Sentry.capture_exception(e) if Setting.sentry_enabled?
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_current_section
|
def set_current_section
|
||||||
|
@ -12,12 +12,7 @@ class Lndhub
|
|||||||
end
|
end
|
||||||
|
|
||||||
res = Faraday.post "#{@base_url}/#{endpoint}", payload.to_json, headers
|
res = Faraday.post "#{@base_url}/#{endpoint}", payload.to_json, headers
|
||||||
|
log_error(res) if res.status != 200
|
||||||
if res.status != 200
|
|
||||||
Rails.logger.error "[lndhub] API request failed:"
|
|
||||||
Rails.logger.error res.body
|
|
||||||
#TODO add some kind of exception tracking/notifications
|
|
||||||
end
|
|
||||||
|
|
||||||
JSON.parse(res.body)
|
JSON.parse(res.body)
|
||||||
end
|
end
|
||||||
@ -68,4 +63,13 @@ class Lndhub
|
|||||||
|
|
||||||
invoice["payment_request"]
|
invoice["payment_request"]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def log_error(res)
|
||||||
|
Rails.logger.error "[lndhub] API request failed:"
|
||||||
|
Rails.logger.error res.body
|
||||||
|
|
||||||
|
if Setting.sentry_enabled?
|
||||||
|
Sentry.capture_message("Lndhub API request failed: #{res.body}")
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user