From: <php...@li...> - 2006-08-10 10:01:48
|
Hello guys, I have an EJB container, which is JBoss, and I access the EJB's via this wonderful PHP / Java Bridge OS Project. In my Java code I use exceptions all the time to detect errors, but most importantly error types, and hence I have customized exceptions (as everyone has) to detect what error happened. They also contain text messages but I do not want to rely on this, since they can change anytime. Well the problem is that in ususal Java code I would check for errors this way : ---------------------------------------------------- try { loginUser(login, password); } catch (BadLoginException ble) { // ... } catch (BadPasswordException bpe) { // ... } ---------------------------------------------------- And so I would determine what failed and choose what to do on this basis. Apparently the only possible thing via the bridge is to use the JavaException type : ---------------------------------------------------- try { $myremoteBean->loginUser($login, $password); } catch (JavaException $je) { // ... } ---------------------------------------------------- So how can I determine which error appeared, without checking the error message (which is - I think - a bad practice) ? I tried with the "java_instanceof" function but it seems that the returned exception is just a "JavaException" object, and that the invoked function's returned exception's type is lost. Thanks for your help!! Etienne Janot |