From c7f21dc353838515d5200fd3fc3d3046dfc1d12c Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Tue, 3 Aug 2021 08:41:35 -0500 Subject: [PATCH 1/2] Log the errorCode and description for deliver-failure deliveryCode and deliveryDescription were the v1 equivalents, but this is v2 --- sgx-bwmsgsv2.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sgx-bwmsgsv2.rb b/sgx-bwmsgsv2.rb index 33cd77a9864704cf3a6d7a78d63fd97a9f5b19a4..ff5e3934e8b2a682898fbdf9fb886f5362187d02 100755 --- a/sgx-bwmsgsv2.rb +++ b/sgx-bwmsgsv2.rb @@ -865,10 +865,10 @@ class WebhookHandler < Goliath::API #', state: ' + jparams['state'] + ', deliveryState: ' + (jparams['deliveryState'] ? jparams['deliveryState'] : 'NONE') + - ', deliveryCode: ' + (jparams['deliveryCode'] ? - jparams['deliveryCode'] : 'NONE') + - ', deliveryDesc: ' + (jparams['deliveryDescription'] ? - jparams['deliveryDescription'] : 'NONE') + + ', errorCode: ' + (jparams['errorCode'] ? + jparams['errorCode'] : 'NONE') + + ', description: ' + (jparams['description'] ? + jparams['description'] : 'NONE') + ', tag: ' + (jparams['tag'] ? jparams['tag'] : 'NONE') + ', media: ' + (jparams['media'] ? jparams['media'].to_s : 'NONE') From 9b5d4467334d1986c1f4aaa980ee0709603c0f91 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Tue, 3 Aug 2021 08:42:15 -0500 Subject: [PATCH 2/2] Give user a tiny bit more context about their failure Let them see the human readable failure description --- sgx-bwmsgsv2.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sgx-bwmsgsv2.rb b/sgx-bwmsgsv2.rb index ff5e3934e8b2a682898fbdf9fb886f5362187d02..d8ec1cb5a9a1009a981d4e86d49e503da0c7806a 100755 --- a/sgx-bwmsgsv2.rb +++ b/sgx-bwmsgsv2.rb @@ -1017,11 +1017,11 @@ class WebhookHandler < Goliath::API # TODO: add 'errorCode' and/or 'description' val # create an error reply to the bare message - msg = Blather::StanzaError.new( - msg, + msg = msg.as_error( 'recipient-unavailable', - :wait - ).to_node + :wait, + jparams['description'] + ) # TODO: make prettier: this should be done above others_num = params['_json'][0]['to']