xenophobia Posted September 29, 2009 Share Posted September 29, 2009 Hi guys, as far as I know, to throw an exception, you put something like this: throw "Something is not right!"; can I do something like this? throw new MyException(); Link to comment https://forums.phpfreaks.com/topic/175900-throwing-exceptions/ Share on other sites More sharing options...
xenophobia Posted September 29, 2009 Author Share Posted September 29, 2009 What you think about something like this: throw "{'exception':'RuntimeException', 'message':'Failed!', 'code':500}"; on the catch statement: catch (ex) { var exception = JSON.parse(ex); } Haha which is kinda stupid... Link to comment https://forums.phpfreaks.com/topic/175900-throwing-exceptions/#findComment-926938 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.