Skip to content

Commit

Permalink
Merge pull request #25444 from nextcloud/bug/25415/move-generic-error…
Browse files Browse the repository at this point in the history
…s-to-end

Check for generic errors at last.
  • Loading branch information
ChristophWurst authored Feb 2, 2021
2 parents 392dc8b + fe37820 commit ad2033e
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 ad2033e

Please sign in to comment.