40
40
* 61 JHV JPX creation taking too long
41
41
* 62 JHV JPX summary file not found
42
42
* 255 GENERAL Unexpected error
45
* Note: If multiple levels of verbosity are needed, one option would be to
46
* split up the complete error message into it's separate parts, add
47
* a "details" field with the full message, and display only the
48
* top-level error message in "error"
45
* Note: If multiple levels of verbosity are needed, one option would be to
46
* split up the complete error message into it's separate parts, add
47
* a "details" field with the full message, and display only the
48
* top-level error message in "error"
50
50
* @see http://www.firephp.org/
52
function handleError($msg, $errorCode=255)
54
//error_log('Error Code '.$errorCode.': '.$msg);
52
function handleError($msg, $errorCode=255) {
54
// error_log('Error Code '.$errorCode.': '.$msg);
55
55
header('Content-type: application/json;charset=UTF-8');
58
58
echo json_encode(array(
64
include_once HV_API_ROOT_DIR ."/lib/FirePHPCore/fb.php";
64
include_once HV_API_DIR.'/lib/FirePHPCore/fb.php';
67
67
// Don't log non-harmful errors
68
68
$dontLog = array(12, 16, 23, 25, 26, 40, 44, 46);
70
if (!in_array($errorCode, $dontLog)) {
70
if ( !in_array($errorCode, $dontLog) ) {
76
76
* Logs an error message to the log whose location is specified in Config.ini
78
78
* @param string $error The body of the error message to be logged.
82
function logErrorMsg($error, $prefix="")
82
function logErrorMsg($error, $prefix='') {
84
83
// API request errors
85
if (isset($_SERVER['HTTP_HOST']) && isset($_SERVER['REQUEST_URI'])) {
84
if ( isset($_SERVER['HTTP_HOST']) && isset($_SERVER['REQUEST_URI']) ) {
86
85
$source = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
88
88
// Resque worker errors
89
$source = "Resque: " . $_SERVER['QUEUE'];
89
$source = 'Resque: ' . $_SERVER['QUEUE'];
92
$log = HV_LOG_DIR . "/$prefix" . date("Ymd_His") . ".log";
94
$template = "====[DATE]====================\n\n%s\n\n====[SOURCE]===================\n\n%s\n\n"
92
$log = HV_LOG_DIR.'/'.$prefix.date('Ymd_His').'.log';
94
$template = "====[DATE]====================\n\n%s\n\n"
95
. "====[SOURCE]==================\n\n%s\n\n"
95
96
. "====[MESSAGE]=================\n\n%s";
97
$msg = sprintf($template, date("Y/m/d H:i:s"), $source, $error);
99
if (!empty($_REQUEST)) {
98
$msg = sprintf($template, date('Y/m/d H:i:s'), $source, $error);
100
if ( !empty($_REQUEST) ) {
100
101
$msg .= "\n\n====[POST]=================\n\n";
101
102
foreach ($_REQUEST as $key => $value) {
102
103
$msg .= "'$key' => $value\n";