From 2d6b9fa392f79e98267bb9a02a68070898cdc1a0 Mon Sep 17 00:00:00 2001 From: Douglas Lise Date: Tue, 26 Sep 2023 15:52:13 -0300 Subject: [PATCH] Emit/forward 'error' event on AmazonPay frame errors --- lib/recurly/amazon/amazon-pay.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/recurly/amazon/amazon-pay.js b/lib/recurly/amazon/amazon-pay.js index bd938895f..10c75fa1c 100644 --- a/lib/recurly/amazon/amazon-pay.js +++ b/lib/recurly/amazon/amazon-pay.js @@ -17,10 +17,9 @@ class AmazonPay extends Emitter { path: `/amazon_pay/start?region=${this.region}`, type: Frame.TYPES.WINDOW, defaultEventName - }).on('error', cause => console.log(cause)) - .on('done', results => { - this.emit('token', results); - }); + }) + .on('error', cause => this.emit('error', cause)) + .on('done', results => this.emit('token', results)); } }