Skip to content

Commit

Permalink
Check for generic errors at last.
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
  • Loading branch information
kesselb committed Feb 2, 2021
1 parent 3a9c7f9 commit fe37820
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions lib/private/DB/Exceptions/DbalException.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,6 @@ public static function wrap(\Doctrine\DBAL\Exception $original, string $message
}

public function getReason(): ?int {
/**
* Generic errors
*/
if ($this->original instanceof ConnectionException) {
return parent::REASON_CONNECTION_LOST;
}
if ($this->original instanceof DriverException) {
return parent::REASON_DRIVER;
}
if ($this->original instanceof InvalidArgumentException) {
return parent::REASON_INVALID_ARGUMENT;
}

/**
* Constraint errors
*/
Expand Down Expand Up @@ -131,6 +118,19 @@ public function getReason(): ?int {
return parent::REASON_SERVER;
}

/**
* Generic errors
*/
if ($this->original instanceof ConnectionException) {
return parent::REASON_CONNECTION_LOST;
}
if ($this->original instanceof InvalidArgumentException) {
return parent::REASON_INVALID_ARGUMENT;
}
if ($this->original instanceof DriverException) {
return parent::REASON_DRIVER;
}

return null;
}
}

0 comments on commit fe37820

Please sign in to comment.