Give slightly more information on Transport API failure.

This commit is contained in:
Robert Gornall
2016-03-23 17:01:06 +00:00
parent 59ad5d06c4
commit 5115095d8f
6 changed files with 10 additions and 6 deletions

View File

@@ -41,7 +41,7 @@ foreach( $opts as $method=>$apis ) {
var_dump("API '$host' returned Error"); //FIXME: propper debuging
var_dump("Params: ".$api); //FIXME: propper debuging
var_dump("Return: ".$ret); //FIXME: propper debuging
return false;
return 'HTTP Status code '.$code;
}
}
}

View File

@@ -28,6 +28,10 @@ foreach($opts as $option) {
}
$curl = curl_init();
if (empty($obj["msg"])) {
return "Empty Message";
}
if (empty($option["message_format"])) {
$option["message_format"] = 'text';
}
@@ -60,7 +64,7 @@ foreach($opts as $option) {
var_dump("API '$url' returned Error");
var_dump("Params: " . $message);
var_dump("Return: " . $ret);
return false;
return 'HTTP Status code '.$code;
}
}
return true;

View File

@@ -48,6 +48,6 @@ $ret = curl_exec($curl);
$code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if( $code != 200 ) {
var_dump("PagerDuty returned Error, retry later"); //FIXME: propper debuging
return false;
return 'HTTP Status code '.$code;
}
return true;

View File

@@ -42,6 +42,6 @@ if( $code > 201 ) {
if( $debug ) {
var_dump($ret);
}
return false;
return 'HTTP Status code '.$code;
}
return true;

View File

@@ -86,7 +86,7 @@ foreach( $opts as $api ) {
$code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if( $code != 200 ) {
var_dump("Pushover returned error"); //FIXME: proper debugging
return false;
return 'HTTP Status code '.$code;
}
}
return true;

View File

@@ -45,7 +45,7 @@ foreach( $opts as $tmp_api ) {
var_dump("API '$host' returned Error"); //FIXME: propper debuging
var_dump("Params: ".$alert_message); //FIXME: propper debuging
var_dump("Return: ".$ret); //FIXME: propper debuging
return false;
return 'HTTP Status code '.$code;
}
}
return true;