I know that MySQL errors are broken down into types of clients and servers. Has anyone noticed any additional structure in the numbering?
I like applications that hide errors from the user and try to repair and continue execution, so I'm trying to switch from printing a line, for example, "Doh! Connection failed". to a special database exception class and one handler to catch all database connection errors that do not fall into the function that threw them or returned them. I believe that I can try to rebuild there and resign if it fails. I thought that I could try using a different catch block for various types of errors, such as connection failures, memory errors, prepared procedure errors, etc. When I tried to find out what the connection errors were for, it seems that there are several clusters that can be connected, however, I'm not sure if some of them are connection errors or not! For example: Error 2048: (CR_INVALID_CONN_HANDLE) Invalid connection handle. (When will this happen?!?)
Some errors listed at briandunning.com/error-codes/?source=MySQL have SQLSTATE code. what it is?
I hope I can check the range or ranges using existing codes. Has anyone else tried to do this? is there a PEAR package? How about a good book?
If they donβt follow the logical pattern, would I rather not collapse my own custom codes? Is there a better approach that I don't see? This is my first time with exceptions, so I could be wrong about that. Thanks!
source share