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

It seems to me that it could be improved error exceptions with the code returned by the database #268

Open
dertin opened this issue Jun 13, 2018 · 1 comment

Comments

@dertin
Copy link

dertin commented Jun 13, 2018

I did not find exactly where this extra information could be added which is useful when evaluating the type of error by means of a code.

try {
    throw new Exception("Can't write; duplicate key in table", 1022);
} catch(Exception $e) {
    echo "The exception code is: " . $e->getCode();
}

https://dev.mysql.com/doc/refman/8.0/en/error-messages-server.html
https://www.postgresql.org/docs/current/static/errcodes-appendix.html

@FlipEverything
Copy link
Contributor

+1

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

No branches or pull requests

2 participants