This commit is contained in:
dante
2017-10-23 15:01:21 -04:00
parent 294707cb42
commit 232c566b67

View File

@@ -761,7 +761,12 @@ class PmDynaform
} catch (Exception $e) {
$this->context["action"] = "execute-sql" . $type;
$this->context["exception"] = (array) $e;
\Bootstrap::registerMonolog("sqlExecution", 400, "Sql Execution", $this->context, $this->sysSys, "processmaker.log");
\Bootstrap::registerMonolog("sqlExecution",
400,
"Sql Execution",
$this->basicExceptionData($e),
$this->sysSys,
"processmaker.log");
}
return $data;
}
@@ -2155,4 +2160,20 @@ class PmDynaform
}
}
/**
* Returns an array with the basic fields of the Exception class. It isn't returned any extra fields information
* of any derivated Exception class. This way we have a lightweight version of the exception data that can
* be used when logging the exception, for example.
* @param $e an Exception class derivate
* @return array
*/
private function basicExceptionData($e)
{
$result = [];
$result['code'] = $e->getCode();
$result['file'] = $e->getFile();
$result['line'] = $e->getLine();
$result['message'] = $e->getMessage();
return $result;
}
}