Skip to content
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

UniqueViolationError fails to parse key with line returns #27

Open
sallustfire opened this issue Jul 7, 2023 · 0 comments
Open

UniqueViolationError fails to parse key with line returns #27

sallustfire opened this issue Jul 7, 2023 · 0 comments

Comments

@sallustfire
Copy link

The UniqueViolationError parser uses a regex to determine if the constraint violation is a suitable error.

const UNIQUE_COLUMNS_REGEX = /Key \((.+)\)=\(.+\) already exists/;

The . character class will not match line break characters as written. Hence a column with a unique index columnA can have a message like Key (columnA)=(Unique\nColumn) already exists., which will not be matched by the regex.

This can be resolved by using a more permissive character class e.g. [\d\D] or single line mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant