Update to Exceptions: add codes, update phpunit tests

DB Class throws Exception if on init it fails to connect to the DB,
will not throw Exception if failed connection during execution but
will do the normal retry and soft failure run
DB\ArrayIO will throw Exception on missing table array and table name

All Exceptions have a code set
This commit is contained in:
Clemens Schwaighofer
2023-09-01 08:37:15 +09:00
parent ec110499a8
commit 33cb05a002
10 changed files with 128 additions and 37 deletions

View File

@@ -13,6 +13,11 @@ use PHPUnit\Framework\TestCase;
*/ */
final class CoreLibsCheckColorsTest extends TestCase final class CoreLibsCheckColorsTest extends TestCase
{ {
/**
* Undocumented function
*
* @return array<mixed>
*/
public function validateColorProvider(): array public function validateColorProvider(): array
{ {
/* /*

View File

@@ -310,52 +310,72 @@ final class CoreLibsCombinedDateTimeTest extends TestCase
'2021-12-12', '2021-12-12',
-1, -1,
null, null,
null,
], ],
'dates equal' => [ 'dates equal' => [
'2020-12-12', '2020-12-12',
'2020-12-12', '2020-12-12',
0, 0,
null, null,
null,
], ],
'second date smaller' => [ 'second date smaller' => [
'2021-12-12', '2021-12-12',
'2020-12-12', '2020-12-12',
1, 1,
null, null,
null,
], ],
'dates equal with different time' => [ 'dates equal with different time' => [
'2020-12-12 12:12:12', '2020-12-12 12:12:12',
'2020-12-12 13:13:13', '2020-12-12 13:13:13',
0, 0,
null, null,
null,
], ],
'invalid dates --' => [ 'invalid dates --' => [
'--', '--',
'--', '--',
false, false,
'UnexpectedValueException', 'UnexpectedValueException',
1,
], ],
'empty dates' => [ 'empty dates' => [
'', '',
'', '',
false, false,
'UnexpectedValueException' 'UnexpectedValueException',
1
], ],
'invalid dates' => [ 'invalid dates' => [
'not a date', 'not a date',
'not a date either', 'not a date either',
false, false,
'UnexpectedValueException' 'UnexpectedValueException',
2
],
'invalid end date' => [
'1990-01-01',
'not a date either',
false,
'UnexpectedValueException',
3
], ],
'out of bound dates' => [ 'out of bound dates' => [
'1900-1-1', '1900-1-1',
'9999-12-31', '9999-12-31',
-1, -1,
null, null,
null,
] ]
]; ];
} }
/**
* Undocumented function
*
* @return array<mixed>
*/
public function dateTimeCompareProvider(): array public function dateTimeCompareProvider(): array
{ {
return [ return [
@@ -364,60 +384,84 @@ final class CoreLibsCombinedDateTimeTest extends TestCase
'2021-12-12', '2021-12-12',
-1, -1,
null, null,
null,
], ],
'dates equal no timestamp' => [ 'dates equal no timestamp' => [
'2020-12-12', '2020-12-12',
'2020-12-12', '2020-12-12',
0, 0,
null, null,
null,
], ],
'second date smaller no timestamp' => [ 'second date smaller no timestamp' => [
'2021-12-12', '2021-12-12',
'2020-12-12', '2020-12-12',
1, 1,
null, null,
null,
], ],
'date equal first time smaller' => [ 'date equal first time smaller' => [
'2020-12-12 12:12:12', '2020-12-12 12:12:12',
'2020-12-12 13:13:13', '2020-12-12 13:13:13',
-1, -1,
null, null,
null,
], ],
'date equal time equal' => [ 'date equal time equal' => [
'2020-12-12 12:12:12', '2020-12-12 12:12:12',
'2020-12-12 12:12:12', '2020-12-12 12:12:12',
0, 0,
null, null,
null,
], ],
'date equal second time smaller' => [ 'date equal second time smaller' => [
'2020-12-12 13:13:13', '2020-12-12 13:13:13',
'2020-12-12 12:12:12', '2020-12-12 12:12:12',
1, 1,
null, null,
null,
], ],
'valid date invalid time' => [ 'valid date invalid time' => [
'2020-12-12 13:99:13', '2020-12-12 13:99:13',
'2020-12-12 12:12:99', '2020-12-12 12:12:99',
false, false,
'UnexpectedValueException' 'UnexpectedValueException',
2
],
'valid date invalid end time' => [
'2020-12-12 13:12:13',
'2020-12-12 12:12:99',
false,
'UnexpectedValueException',
3
], ],
'invalid datetimes --' => [ 'invalid datetimes --' => [
'--', '--',
'--', '--',
false, false,
'UnexpectedValueException' 'UnexpectedValueException',
1
], ],
'empty datetimess' => [ 'empty datetimess' => [
'', '',
'', '',
false, false,
'UnexpectedValueException' 'UnexpectedValueException',
1
], ],
'invalid datetimes' => [ 'invalid date times' => [
'not a date', 'not a date',
'not a date either', 'not a date either',
false, false,
'UnexpectedValueException' 'UnexpectedValueException',
2
],
'invalid end date time' => [
'1990-01-01 12:12:12',
'not a date either',
false,
'UnexpectedValueException',
3
], ],
]; ];
} }
@@ -632,12 +676,20 @@ final class CoreLibsCombinedDateTimeTest extends TestCase
* @param string $input_a * @param string $input_a
* @param string $input_b * @param string $input_b
* @param int|bool $expected * @param int|bool $expected
* @param string|null $exception
* @param int|null $exception_code
* @return void * @return void
*/ */
public function testCompareDate(string $input_a, string $input_b, int|bool $expected, ?string $exception): void public function testCompareDate(
{ string $input_a,
string $input_b,
int|bool $expected,
?string $exception,
?int $exception_code
): void {
if ($expected === false) { if ($expected === false) {
$this->expectException($exception); $this->expectException($exception);
$this->expectExceptionCode($exception_code);
} }
$this->assertEquals( $this->assertEquals(
$expected, $expected,
@@ -655,12 +707,20 @@ final class CoreLibsCombinedDateTimeTest extends TestCase
* @param string $input_a * @param string $input_a
* @param string $input_b * @param string $input_b
* @param int|bool $expected * @param int|bool $expected
* @param string|null $exception
* @param int|null $exception_code
* @return void * @return void
*/ */
public function testCompareDateTime(string $input_a, string $input_b, int|bool $expected, ?string $exception): void public function testCompareDateTime(
{ string $input_a,
string $input_b,
int|bool $expected,
?string $exception,
?int $exception_code
): void {
if ($expected === false) { if ($expected === false) {
$this->expectException($exception); $this->expectException($exception);
$this->expectExceptionCode($exception_code);
} }
$this->assertEquals( $this->assertEquals(
$expected, $expected,

View File

@@ -32,7 +32,8 @@ final class CoreLibsCreateSessionTest extends TestCase
// getSessionId: string or false // getSessionId: string or false
// 3: exepcted name (session)] // 3: exepcted name (session)]
// 4: Exception thrown on error // 4: Exception thrown on error
// 5: expected error string // 5: exception code, null for none
// 6: expected error string
return [ return [
'session parameter' => [ 'session parameter' => [
'sessionNameParameter', 'sessionNameParameter',
@@ -46,6 +47,7 @@ final class CoreLibsCreateSessionTest extends TestCase
], ],
'sessionNameParameter', 'sessionNameParameter',
null, null,
null,
'', '',
], ],
'session globals' => [ 'session globals' => [
@@ -60,6 +62,7 @@ final class CoreLibsCreateSessionTest extends TestCase
], ],
'sessionNameGlobals', 'sessionNameGlobals',
null, null,
null,
'', '',
], ],
'session name default' => [ 'session name default' => [
@@ -74,6 +77,7 @@ final class CoreLibsCreateSessionTest extends TestCase
], ],
'', '',
null, null,
null,
'', '',
], ],
// error checks // error checks
@@ -90,6 +94,7 @@ final class CoreLibsCreateSessionTest extends TestCase
], ],
'', '',
'RuntimeException', 'RuntimeException',
1,
'[SESSION] No sessions in php cli' '[SESSION] No sessions in php cli'
], ],
// 2: session disabled // 2: session disabled
@@ -105,6 +110,7 @@ final class CoreLibsCreateSessionTest extends TestCase
], ],
'', '',
'RuntimeException', 'RuntimeException',
2,
'[SESSION] Sessions are disabled' '[SESSION] Sessions are disabled'
], ],
// 3: invalid session name: string // 3: invalid session name: string
@@ -120,6 +126,7 @@ final class CoreLibsCreateSessionTest extends TestCase
], ],
'', '',
'UnexpectedValueException', 'UnexpectedValueException',
3,
'[SESSION] Invalid session name: 1invalid$session#;' '[SESSION] Invalid session name: 1invalid$session#;'
], ],
// 3: invalid session name: only numbers // 3: invalid session name: only numbers
@@ -135,6 +142,7 @@ final class CoreLibsCreateSessionTest extends TestCase
], ],
'', '',
'UnexpectedValueException', 'UnexpectedValueException',
3,
'[SESSION] Invalid session name: 123' '[SESSION] Invalid session name: 123'
], ],
// 3: invalid session name: invalid name short // 3: invalid session name: invalid name short
@@ -152,6 +160,7 @@ final class CoreLibsCreateSessionTest extends TestCase
], ],
'', '',
'RuntimeException', 'RuntimeException',
4,
'[SESSION] Failed to activate session' '[SESSION] Failed to activate session'
], ],
// 5: get session id return false // 5: get session id return false
@@ -167,6 +176,7 @@ final class CoreLibsCreateSessionTest extends TestCase
], ],
'', '',
'UnexpectedValueException', 'UnexpectedValueException',
5,
'[SESSION] getSessionId did not return a session id' '[SESSION] getSessionId did not return a session id'
], ],
]; ];
@@ -193,6 +203,7 @@ final class CoreLibsCreateSessionTest extends TestCase
array $mock_data, array $mock_data,
string $expected, string $expected,
?string $exception, ?string $exception,
?int $exception_code,
string $expected_error string $expected_error
): void { ): void {
// override expected // override expected
@@ -238,6 +249,7 @@ final class CoreLibsCreateSessionTest extends TestCase
if ($exception !== null) { if ($exception !== null) {
$this->expectException($exception); $this->expectException($exception);
$this->expectExceptionCode($exception_code);
} }
unset($GLOBALS['SET_SESSION_NAME']); unset($GLOBALS['SET_SESSION_NAME']);

View File

@@ -445,12 +445,14 @@ final class CoreLibsDBIOTest extends TestCase
{ {
// 0: connection array // 0: connection array
// 1: status after connection // 1: status after connection
// 2: exception name
// 2: info string // 2: info string
// 3: ??? // 3: ???
return [ return [
'invalid connection' => [ 'invalid connection' => [
self::$db_config['invalid'], self::$db_config['invalid'],
false, false,
'RuntimeException',
"-DB-info-> Connected to db '' with schema 'public' as user " "-DB-info-> Connected to db '' with schema 'public' as user "
. "'' at host '' on port '5432' with ssl mode 'allow' **** " . "'' at host '' on port '5432' with ssl mode 'allow' **** "
. "-DB-info-> DB IO Class debug output: Yes **** ", . "-DB-info-> DB IO Class debug output: Yes **** ",
@@ -459,6 +461,7 @@ final class CoreLibsDBIOTest extends TestCase
'valid connection' => [ 'valid connection' => [
self::$db_config['valid'], self::$db_config['valid'],
true, true,
'',
"-DB-info-> Connected to db 'corelibs_db_io_test' with " "-DB-info-> Connected to db 'corelibs_db_io_test' with "
. "schema 'public' as user 'corelibs_db_io_test' at host " . "schema 'public' as user 'corelibs_db_io_test' at host "
. "'localhost' on port '5432' with ssl mode 'allow' **** " . "'localhost' on port '5432' with ssl mode 'allow' **** "
@@ -475,13 +478,21 @@ final class CoreLibsDBIOTest extends TestCase
* @dataProvider connectionProvider * @dataProvider connectionProvider
* @testdox Connection will be $expected [$_dataName] * @testdox Connection will be $expected [$_dataName]
* *
* @param array $connection
* @param bool $expected_status
* @param string $exception
* @param string $expected_string
* @return void * @return void
*/ */
public function testConnection( public function testConnection(
array $connection, array $connection,
bool $expected_status, bool $expected_status,
string $exception,
string $expected_string string $expected_string
): void { ): void {
if ($expected_status === false) {
$this->expectException($exception);
}
$db = new \CoreLibs\DB\IO( $db = new \CoreLibs\DB\IO(
$connection, $connection,
self::$log self::$log

View File

@@ -403,7 +403,6 @@ class Login
$this->log->info($message, ['code' => $code]); $this->log->info($message, ['code' => $code]);
} else { } else {
$this->log->critical($message, ['code' => $code]); $this->log->critical($message, ['code' => $code]);
// throw new \Exception($message, $code);
} }
exit($code); exit($code);
} }

View File

@@ -328,14 +328,14 @@ class DateTime
{ {
// pre check for empty or wrong // pre check for empty or wrong
if ($start_date == '--' || $end_date == '--' || empty($start_date) || empty($end_date)) { if ($start_date == '--' || $end_date == '--' || empty($start_date) || empty($end_date)) {
throw new \UnexpectedValueException('Start or End date not set or are just "--"'); throw new \UnexpectedValueException('Start or End date not set or are just "--"', 1);
} }
// if invalid, quit // if invalid, quit
if (($start_timestamp = strtotime($start_date)) === false) { if (($start_timestamp = strtotime($start_date)) === false) {
throw new \UnexpectedValueException("Error parsing start date through strtotime()"); throw new \UnexpectedValueException("Error parsing start date through strtotime()", 2);
} }
if (($end_timestamp = strtotime($end_date)) === false) { if (($end_timestamp = strtotime($end_date)) === false) {
throw new \UnexpectedValueException("Error parsing end date through strtotime()"); throw new \UnexpectedValueException("Error parsing end date through strtotime()", 3);
} }
$comp = 0; $comp = 0;
// convert anything to Y-m-d and then to timestamp // convert anything to Y-m-d and then to timestamp
@@ -371,14 +371,14 @@ class DateTime
{ {
// pre check for empty or wrong // pre check for empty or wrong
if ($start_datetime == '--' || $end_datetime == '--' || empty($start_datetime) || empty($end_datetime)) { if ($start_datetime == '--' || $end_datetime == '--' || empty($start_datetime) || empty($end_datetime)) {
throw new \UnexpectedValueException('Start or end timestamp not set or are just "--"'); throw new \UnexpectedValueException('Start or end timestamp not set or are just "--"', 1);
} }
// quit if invalid timestamp // quit if invalid timestamp
if (($start_timestamp = strtotime($start_datetime)) === false) { if (($start_timestamp = strtotime($start_datetime)) === false) {
throw new \UnexpectedValueException("Error parsing start timestamp through strtotime()"); throw new \UnexpectedValueException("Error parsing start timestamp through strtotime()", 2);
} }
if (($end_timestamp = strtotime($end_datetime)) === false) { if (($end_timestamp = strtotime($end_datetime)) === false) {
throw new \UnexpectedValueException("Error parsing end timestamp through strtotime()"); throw new \UnexpectedValueException("Error parsing end timestamp through strtotime()", 3);
} }
$comp = 0; $comp = 0;
// compare, or return false // compare, or return false

View File

@@ -45,7 +45,7 @@ class Colors
// if not valid, abort // if not valid, abort
if ($$color < 0 || $$color > 255) { if ($$color < 0 || $$color > 255) {
throw new \LengthException('Argument value ' . $$color . ' for color ' . $color throw new \LengthException('Argument value ' . $$color . ' for color ' . $color
. ' is not in the range of 0 to 255'); . ' is not in the range of 0 to 255', 1);
} }
// pad left with 0 // pad left with 0
$hex_color .= str_pad(dechex($$color), 2, '0', STR_PAD_LEFT); $hex_color .= str_pad(dechex($$color), 2, '0', STR_PAD_LEFT);
@@ -71,7 +71,7 @@ class Colors
): string|array { ): string|array {
$hex_string = preg_replace("/[^0-9A-Fa-f]/", '', $hex_string); // Gets a proper hex string $hex_string = preg_replace("/[^0-9A-Fa-f]/", '', $hex_string); // Gets a proper hex string
if (!is_string($hex_string)) { if (!is_string($hex_string)) {
throw new \InvalidArgumentException('hex_string argument cannot be empty'); throw new \InvalidArgumentException('hex_string argument cannot be empty', 1);
} }
$rgbArray = []; $rgbArray = [];
if (strlen($hex_string) == 6) { if (strlen($hex_string) == 6) {
@@ -88,7 +88,7 @@ class Colors
$rgbArray['b'] = hexdec(str_repeat(substr($hex_string, 2, 1), 2)); $rgbArray['b'] = hexdec(str_repeat(substr($hex_string, 2, 1), 2));
} else { } else {
// Invalid hex color code // Invalid hex color code
throw new \UnexpectedValueException('Invalid hex_string: ' . $hex_string); throw new \UnexpectedValueException('Invalid hex_string: ' . $hex_string, 2);
} }
// returns the rgb string or the associative array // returns the rgb string or the associative array
return $return_as_string ? implode($seperator, $rgbArray) : $rgbArray; return $return_as_string ? implode($seperator, $rgbArray) : $rgbArray;
@@ -112,7 +112,7 @@ class Colors
foreach (['red', 'green', 'blue'] as $color) { foreach (['red', 'green', 'blue'] as $color) {
if ($$color < 0 || $$color > 255) { if ($$color < 0 || $$color > 255) {
throw new \LengthException('Argument value ' . $$color . ' for color ' . $color throw new \LengthException('Argument value ' . $$color . ' for color ' . $color
. ' is not in the range of 0 to 255'); . ' is not in the range of 0 to 255', 1);
} }
$$color = $$color / 255; $$color = $$color / 255;
} }
@@ -162,13 +162,13 @@ class Colors
$H = 0; $H = 0;
} }
if ($H < 0 || $H > 359) { if ($H < 0 || $H > 359) {
throw new \LengthException('Argument value ' . $H . ' for hue is not in the range of 0 to 359'); throw new \LengthException('Argument value ' . $H . ' for hue is not in the range of 0 to 359', 1);
} }
if ($S < 0 || $S > 100) { if ($S < 0 || $S > 100) {
throw new \LengthException('Argument value ' . $S . ' for saturation is not in the range of 0 to 100'); throw new \LengthException('Argument value ' . $S . ' for saturation is not in the range of 0 to 100', 2);
} }
if ($V < 0 || $V > 100) { if ($V < 0 || $V > 100) {
throw new \LengthException('Argument value ' . $V . ' for brightness is not in the range of 0 to 100'); throw new \LengthException('Argument value ' . $V . ' for brightness is not in the range of 0 to 100', 3);
} }
// convert to internal 0-1 format // convert to internal 0-1 format
$S /= 100; $S /= 100;
@@ -246,7 +246,7 @@ class Colors
foreach (['red', 'green', 'blue'] as $color) { foreach (['red', 'green', 'blue'] as $color) {
if ($$color < 0 || $$color > 255) { if ($$color < 0 || $$color > 255) {
throw new \LengthException('Argument value ' . $$color . ' for color ' . $color throw new \LengthException('Argument value ' . $$color . ' for color ' . $color
. ' is not in the range of 0 to 255'); . ' is not in the range of 0 to 255', 1);
} }
$$color = $$color / 255; $$color = $$color / 255;
} }
@@ -301,13 +301,13 @@ class Colors
$hue = 0; $hue = 0;
} }
if ($hue < 0 || $hue > 359) { if ($hue < 0 || $hue > 359) {
throw new \LengthException('Argument value ' . $hue . ' for hue is not in the range of 0 to 359'); throw new \LengthException('Argument value ' . $hue . ' for hue is not in the range of 0 to 359', 1);
} }
if ($sat < 0 || $sat > 100) { if ($sat < 0 || $sat > 100) {
throw new \LengthException('Argument value ' . $sat . ' for saturation is not in the range of 0 to 100'); throw new \LengthException('Argument value ' . $sat . ' for saturation is not in the range of 0 to 100', 2);
} }
if ($lum < 0 || $lum > 100) { if ($lum < 0 || $lum > 100) {
throw new \LengthException('Argument value ' . $lum . ' for luminance is not in the range of 0 to 100'); throw new \LengthException('Argument value ' . $lum . ' for luminance is not in the range of 0 to 100', 3);
} }
// calc to internal convert value for hue // calc to internal convert value for hue
$hue = (1 / 360) * $hue; $hue = (1 / 360) * $hue;

View File

@@ -106,11 +106,11 @@ class Session
{ {
// we can't start sessions on command line // we can't start sessions on command line
if ($this->checkCliStatus()) { if ($this->checkCliStatus()) {
throw new \RuntimeException('[SESSION] No sessions in php cli'); throw new \RuntimeException('[SESSION] No sessions in php cli', 1);
} }
// if session are OFF // if session are OFF
if ($this->getSessionStatus() === PHP_SESSION_DISABLED) { if ($this->getSessionStatus() === PHP_SESSION_DISABLED) {
throw new \RuntimeException('[SESSION] Sessions are disabled'); throw new \RuntimeException('[SESSION] Sessions are disabled', 2);
} }
// session_status // session_status
// initial the session if there is no session running already // initial the session if there is no session running already
@@ -123,7 +123,7 @@ class Session
if (!empty($session_name)) { if (!empty($session_name)) {
// invalid session name, abort // invalid session name, abort
if (!$this->checkValidSessionName($session_name)) { if (!$this->checkValidSessionName($session_name)) {
throw new \UnexpectedValueException('[SESSION] Invalid session name: ' . $session_name); throw new \UnexpectedValueException('[SESSION] Invalid session name: ' . $session_name, 3);
} }
$this->setSessionName($session_name); $this->setSessionName($session_name);
} }
@@ -132,10 +132,10 @@ class Session
} }
// if we still have no active session // if we still have no active session
if (!$this->checkActiveSession()) { if (!$this->checkActiveSession()) {
throw new \RuntimeException('[SESSION] Failed to activate session'); throw new \RuntimeException('[SESSION] Failed to activate session', 4);
} }
if (false === ($session_id = $this->getSessionId())) { if (false === ($session_id = $this->getSessionId())) {
throw new \UnexpectedValueException('[SESSION] getSessionId did not return a session id'); throw new \UnexpectedValueException('[SESSION] getSessionId did not return a session id', 5);
} }
return $session_id; return $session_id;
} }

View File

@@ -61,6 +61,7 @@ class ArrayIO extends \CoreLibs\DB\IO
* @param \CoreLibs\Logging\Logging $log Logging class * @param \CoreLibs\Logging\Logging $log Logging class
* @param int $base_acl_level Set base acl level, if needed * @param int $base_acl_level Set base acl level, if needed
* @param int $acl_admin Flag if this is an admin ACL access level * @param int $acl_admin Flag if this is an admin ACL access level
* @throws \RuntimeException Missing table array or table name entry
*/ */
public function __construct( public function __construct(
array $db_config, array $db_config,
@@ -83,6 +84,7 @@ class ArrayIO extends \CoreLibs\DB\IO
// error abort if no table array or no table name // error abort if no table array or no table name
if (empty($table_array) || empty($table_name)) { if (empty($table_array) || empty($table_name)) {
$this->__dbError(1999, false, 'MAJOR ERROR: Core settings missing'); $this->__dbError(1999, false, 'MAJOR ERROR: Core settings missing');
throw new \RuntimeException('MAJOR ERROR: Core settings missing', 1999);
} }
// set primary key for given table_array // set primary key for given table_array

View File

@@ -414,6 +414,7 @@ class IO
* phpcs:ignore * phpcs:ignore
* @param array{db_name:string,db_user:string,db_pass:string,db_host:string,db_port:int,db_schema:string,db_encoding:string,db_type:string,db_ssl:string,db_convert_type?:string[]} $db_config DB configuration array * @param array{db_name:string,db_user:string,db_pass:string,db_host:string,db_port:int,db_schema:string,db_encoding:string,db_type:string,db_ssl:string,db_convert_type?:string[]} $db_config DB configuration array
* @param \CoreLibs\Logging\Logging $log Logging class * @param \CoreLibs\Logging\Logging $log Logging class
* @throws \RuntimeException If no DB connection can be established on launch
*/ */
public function __construct( public function __construct(
array $db_config, array $db_config,
@@ -492,6 +493,7 @@ class IO
if (!$this->__connectToDB()) { if (!$this->__connectToDB()) {
$this->__dbError(16); $this->__dbError(16);
$this->db_connection_closed = true; $this->db_connection_closed = true;
throw new \RuntimeException('INIT: No DB Handler found / connect or reconnect failed', 16);
} }
} }
@@ -974,9 +976,9 @@ class IO
/** /**
* write an error * write an error
* *
* @param integer $error_id Any Error ID, used in debug message string * @param integer $error_id Any Error ID, used in debug message string
* @param \PgSql\Result|false $cursor Optional cursor, passed on to preprocessor * @param \PgSql\Result|false $cursor Optional cursor, passed on to preprocessor
* @param string $msg optional message added to debug * @param string $msg optional message added to debug
* @return void * @return void
*/ */
protected function __dbError( protected function __dbError(