Skip to content

Commit 0f0b7b9

Browse files
committed
change exception thrown by Sap::getAttributes() to LogicException when no connection available
1 parent 495a1b8 commit 0f0b7b9

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

classes/Sap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function getFunctionClass(): string
9494
*
9595
* @return array
9696
*
97-
* @throws SapConnectionException if no connection is available
97+
* @throws LogicException if no connection is available
9898
*/
9999
public function getAttributes(): array
100100
{

php_sap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2266,7 +2266,7 @@ PHP_METHOD(Sap, getAttributes)
22662266
int utf8len;
22672267

22682268
if (NULL == intern->connection) {
2269-
zend_throw_exception(sap_ce_SapConnectionException, PHP_SAP_NO_CONNECTION, -1);
2269+
zend_throw_exception(spl_ce_LogicException, PHP_SAP_NO_CONNECTION, -1);
22702270
return;
22712271
}
22722272

tests/sap_Sap___construct_basic.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ $s = new Sap();
1515

1616
/** test connect() is not called */
1717
try { $s->getAttributes(); }
18-
catch (SapConnectionException $e) {
18+
catch (LogicException $e) {
1919
echo $e->getMessage(), PHP_EOL;
2020
}
2121

@@ -24,7 +24,7 @@ $s = new Sap(null);
2424

2525
/** test connect() is not called */
2626
try { $s->getAttributes(); }
27-
catch (SapConnectionException $e) {
27+
catch (LogicException $e) {
2828
echo $e->getMessage(), PHP_EOL;
2929
}
3030

tests/sap_Sap_getAttributes_error.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Sap::getAttributes error behavior
55
$s = new Sap();
66

77
try { $s->getAttributes(); }
8-
catch (SapConnectionException $e) {
8+
catch (LogicException $e) {
99
echo $e->getMessage(), PHP_EOL;
1010
}
1111
?>

0 commit comments

Comments
 (0)