Commit c7d4a5bf authored by Carsten  Rose's avatar Carsten Rose
Browse files

KVP Exception 'missing key name': more detailed error.

parent 772f66fd
Pipeline #1049 passed with stage
in 1 minute and 54 seconds
......@@ -22,6 +22,18 @@ require_once(__DIR__ . '/../helper/Support.php');
/**
* Class AbstractException
*
* Throw with ONE message
*
* throw new UserFormException('Failed: chmod ....', ERROR_IO_CHMOD);
*
* Throw with message for User and message for Support.
*
* throw new UserFormException( json_encode(
* [ERROR_MESSAGE_TO_USER => 'Failed: chmod',
* ERROR_MESSAGE_SUPPORT => "Failed: chmod $mode '$pathFileName'"]),
* ERROR_IO_CHMOD);
*
* @package qfq
*/
class AbstractException extends \Exception {
......
......@@ -15,6 +15,17 @@ require_once(__DIR__ . '/AbstractException.php');
*
* Thrown by Form or FormElement on User errors
*
* Throw with ONE message
*
* throw new UserFormException('Failed: chmod ....', ERROR_IO_CHMOD);
*
* Throw with message for User and message for Support.
*
* throw new UserFormException( json_encode(
* [ERROR_MESSAGE_TO_USER => 'Failed: chmod',
* ERROR_MESSAGE_SUPPORT => "Failed: chmod $mode '$pathFileName'"]),
* ERROR_IO_CHMOD);
*
* @package qfq\exceptions
*/
class CodeException extends AbstractException {
......
......@@ -16,6 +16,17 @@ require_once(__DIR__ . '/AbstractException.php');
*
* Thrown by Form or FormElement on User errors
*
* Throw with ONE message
*
* throw new UserFormException('Failed: chmod ....', ERROR_IO_CHMOD);
*
* Throw with message for User and message for Support.
*
* throw new UserFormException( json_encode(
* [ERROR_MESSAGE_TO_USER => 'Failed: chmod',
* ERROR_MESSAGE_SUPPORT => "Failed: chmod $mode '$pathFileName'"]),
* ERROR_IO_CHMOD);
*
* @package qfq\exceptions
*/
class DbException extends AbstractException {
......
......@@ -15,6 +15,17 @@ require_once(__DIR__ . '/AbstractException.php');
*
* Thrown by Download
*
* Throw with ONE message
*
* throw new UserFormException('Failed: chmod ....', ERROR_IO_CHMOD);
*
* Throw with message for User and message for Support.
*
* throw new UserFormException( json_encode(
* [ERROR_MESSAGE_TO_USER => 'Failed: chmod',
* ERROR_MESSAGE_SUPPORT => "Failed: chmod $mode '$pathFileName'"]),
* ERROR_IO_CHMOD);
*
* @package qfq\exceptions
*/
class DownloadException extends AbstractException {
......
......@@ -15,6 +15,17 @@ require_once(__DIR__ . '/AbstractException.php');
*
* Thrown by AutoCron...
*
* Throw with ONE message
*
* throw new UserFormException('Failed: chmod ....', ERROR_IO_CHMOD);
*
* Throw with message for User and message for Support.
*
* throw new UserFormException( json_encode(
* [ERROR_MESSAGE_TO_USER => 'Failed: chmod',
* ERROR_MESSAGE_SUPPORT => "Failed: chmod $mode '$pathFileName'"]),
* ERROR_IO_CHMOD);
*
* @package qfq\exceptions
*/
class ShellException extends AbstractException {
......
......@@ -16,6 +16,19 @@ require_once(__DIR__ . '/AbstractException.php');
*
* Thrown by Form or FormElement on User errors
*
* Throw with ONE message
*
* throw new UserFormException('Failed: chmod ....', ERROR_IO_CHMOD);
*
* Throw with message for User and message for Support.
*
* throw new UserFormException( json_encode(
* [ERROR_MESSAGE_TO_USER => 'Failed: chmod',
* ERROR_MESSAGE_SUPPORT => "Failed: chmod $mode '$pathFileName'"]),
* ERROR_IO_CHMOD);
*
* Call
*
* @package qfq\exceptions
*/
class UserFormException extends AbstractException {
......
......@@ -15,6 +15,17 @@ require_once(__DIR__ . '/AbstractException.php');
*
* Thrown by Report on User errors
*
* Throw with ONE message
*
* throw new UserFormException('Failed: chmod ....', ERROR_IO_CHMOD);
*
* Throw with message for User and message for Support.
*
* throw new UserFormException( json_encode(
* [ERROR_MESSAGE_TO_USER => 'Failed: chmod',
* ERROR_MESSAGE_SUPPORT => "Failed: chmod $mode '$pathFileName'"]),
* ERROR_IO_CHMOD);
*
* @package qfq\exceptions
*/
class UserReportException extends AbstractException {
......
......@@ -136,7 +136,10 @@ class KeyValueStringParser {
if ($key === '') {
// ":", ":1"
throw new UserFormException("Value has no key: '$keyValuePairString'", ERROR_KVP_VALUE_HAS_NO_KEY);
throw new UserFormException(json_encode(
[ERROR_MESSAGE_TO_USER => "Value has no key: '$keyValuePairString'",
ERROR_MESSAGE_SUPPORT => "KVP='$keyValueString', keyValueDelimiter='$keyValueDelimiter', listDelimiter='$listDelimiter'"]),
ERROR_KVP_VALUE_HAS_NO_KEY);
}
if (count($keyValueArray) === 2) {
......@@ -246,7 +249,7 @@ class KeyValueStringParser {
switch ($trimmed[0]) {
case SINGLE_TICK:
case DOUBLE_TICK:
if ($trimmed[0] == substr($trimmed, -1)) {
if ($trimmed[0] == substr($trimmed, -1)) {
break; // In case start and end token is in one exploded item
}
$startToken = $trimmed[0];
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment