-
Notifications
You must be signed in to change notification settings - Fork 55
Unique Exception #733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Unique Exception #733
Changes from 4 commits
f87ec3d
726868a
bbd9f4f
c9daebf
e4412d7
53e1a2e
07f9850
231d53e
2b59a27
22648b0
6c651e7
ce620a6
6a9c42a
968fff6
eda18d6
7ce3ae6
a163eb3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,9 @@ | ||||||
| <?php | ||||||
|
|
||||||
| namespace Utopia\Database\Exception; | ||||||
|
|
||||||
| use Utopia\Database\Exception; | ||||||
|
|
||||||
| class Unique extends Exception | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It also preserves backward compatibility: existing catch blocks for
Suggested change
with |
||||||
| { | ||||||
| } | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_uidduplicate toUniqueExceptionIf
preg_matchfails to match (e.g. the PDO error message omits theDETAILline, or the Postgres locale formats it differently), execution falls through toreturn new UniqueException(...). Before this PR every 23505 returnedDuplicateException; now an unmatched primary-key duplicate silently becomes aUniqueException, breaking callers that check$e instanceof DuplicateException && !($e instanceof UniqueException). A safe fallback would returnDuplicateExceptionwhen the regex cannot resolve the column list.