Closed Sashkan closed 8 years ago
I'm using a simple rake task to browse through my transactions. Each of my payments has its own mangopay_user_id. Is there a way to test the ID without raising an error if the object does not exist ?
payments
mangopay_user_id
@payin = MangoPay::PayIn.fetch(payment.mangopay_charge_id)
raises me a:
The ressource does not exist RessourceNotFound: Cannot found the ressource PayIn with the id=52282550
And therefore aborst the rake.
@Sashkan you can just use ruby's rescue to handle that case.
begin @payin = MangoPay::PayIn.fetch(payment.mangopay_charge_id) rescue MangoPay::ResponseError => error puts error end
I'm using a simple rake task to browse through my transactions. Each of my
payments
has its ownmangopay_user_id
. Is there a way to test the ID without raising an error if the object does not exist ?raises me a:
And therefore aborst the rake.