开发者

Error handling Symfony custom library

Hey guys, I'm writing a library that will reside in the /lib folder that deals with processing a credit/debit card transaction.

I'm using the Forms framework to accept and validate the card details and then from my actions.class.php for that module, it instantiates my custom library that deals with the SOAP call to process the transaction.

My question is what is th开发者_如何学运维e best way to handle the potential errors, ie. setting up the SOAP call, processing the call, and then handling the response, which in terms of the transaction might be success or fail (with more information to feed back?).

I'm thinking something like a global error array and pre-defined error messages set in a config file somewhere. My actions.class.php ultimately receives a TRUE or FALSE, but if FALSE I need to inspect the error array and deal with it accordingly.

Any ideas?

Thank


What is the "place" that knows all about the potential errors? From your description I think it's the SOAP library. If it's your library, you should put the error codes there. Depending on how you show the errors to the user and if/how your app is localized, you then put the actual error messages (= what the user sees) where it makes the most sense.

If the SOAP lib is not yours then inspect the documentation and see what types of errors and error messages you may receive.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜