summaryrefslogtreecommitdiff
path: root/classes/handler.php
diff options
context:
space:
mode:
authorValentin Popov <info@valentineus.link>2017-10-27 11:41:15 +0300
committerValentin Popov <info@valentineus.link>2017-10-27 11:41:15 +0300
commit31ecf15e9543aed0e1b7946354735c77886e2b68 (patch)
tree826cf0a27cbd69ebc8d2fe48aa4627325bb24c84 /classes/handler.php
parent8afc94b51cbe76a355c42201d70747ce68008792 (diff)
downloadlocal_webhooks-31ecf15e9543aed0e1b7946354735c77886e2b68.tar.xz
local_webhooks-31ecf15e9543aed0e1b7946354735c77886e2b68.zip
Filtering for possible errors
Diffstat (limited to 'classes/handler.php')
-rw-r--r--classes/handler.php16
1 files changed, 11 insertions, 5 deletions
diff --git a/classes/handler.php b/classes/handler.php
index 6cf1cc1..6ed9da7 100644
--- a/classes/handler.php
+++ b/classes/handler.php
@@ -113,11 +113,17 @@ class handler {
* @param object $callback
*/
private static function logger($callback, $response) {
- $event = \local_webhooks\event\response_get::create(array(
- "context" => \context_system::instance(0),
- "objectid" => $callback->id,
- "other" => array(
- "status" => $response["HTTP/1.1"]
+ $status = "Error sending request";
+ if (!empty($response["HTTP/1.1"])) {
+ $status = $response["HTTP/1.1"];
+ }
+
+ $event = \local_webhooks\event\response_get::create(
+ array(
+ "context" => \context_system::instance(0),
+ "objectid" => $callback->id,
+ "other" => array(
+ "status" => $status
)
));