ulsdevteam / sms-send-receive

0 stars 0 forks source link

Capture additional detail on errors #3

Open ctgraham opened 3 years ago

ctgraham commented 3 years ago

https://github.com/ulsdevteam/sms-send-receive/blob/3a7fc2d31654a698966d1af8d20c94c9ab3bc690/reply.php#L15

https://github.com/ulsdevteam/sms-send-receive/blob/3a7fc2d31654a698966d1af8d20c94c9ab3bc690/reply.php#L21

are scant on error information, which may be present (and useful?) in $e->getMessage()

ctgraham commented 3 years ago

Could the logic be simplified to:

} catch(\UnexpectedValueException | \Telnyx\Exception\SignatureVerificationException $e) {
        // Output error message
        error_log($e->getMessage()); 
        // Send status code to signal that the webhook was NOT successfully received
        http_response_code(400);
        exit();
    }

?

wopsononock commented 3 years ago

Looks great, I added that in 490b268f809a1965f0af6fc0f95983f58d5cf4e6