Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Create Workspace error handling on postgres #80

Closed
dbu opened this Issue Jan 7, 2013 · 3 comments

Comments

Projects
None yet
2 participants
Owner

dbu commented Jan 7, 2013

#79 wants to expose the dbal error unless it really is the duplicate workspace problem. it works fine with mysql and sqlite, but not with postgres.

@lsmith77 says: ts indeed not possible to rely on sqlstate error codes .. the mapping done inside pdo is not reliable. so we may need to do a platform check in there.

@Burgov: would you be ok to check this out? i guess postgres uses a different status code in that situation... so the trick would be to check whether we are on postgres or mysql (there are examples in the Client class how to determine the platform)

Contributor

Burgov commented Jan 7, 2013

@dbu: perhaps we shouldn't catch the exception at all? I think the error message from DBAL will be clear enough for the developer.

Another option might be to read the DBAL exception message, instead of the PDO exception code. I think these messages are always the same regardless of the layer (too bad DBAL doesn't throw different exception classes for different situations)

Owner

dbu commented Jan 7, 2013

i think it does make sense to distinguish. not catching at all would violate the api contract - if a user writes catch(RepositoryException $e) he will not catch Dbal exceptions...

one thing we surely should do is nest the dbal exception into the RepositoryException we throw. the message is probably localized, so i guess that would be even worse. but if you manage to find the code for postgres, we should hopefully have it covered.

Owner

dbu commented Jan 8, 2013

fixed in #81

@dbu dbu closed this Jan 8, 2013

@doctrinebot doctrinebot referenced this issue in doctrine/dbal Dec 6, 2015

Closed

DBAL-407: Refactor exceptions #1600

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment