{"id":1781,"date":"2017-09-28T13:10:58","date_gmt":"2017-09-28T13:10:58","guid":{"rendered":"https:\/\/ibex.tech\/cloud\/?p=1781"},"modified":"2026-02-13T16:34:08","modified_gmt":"2026-02-13T16:34:08","slug":"try-catch-error-handling","status":"publish","type":"post","link":"https:\/\/ibex.tech\/cloud\/php\/errors\/try-catch-error-handling","title":{"rendered":"Try Catch error handling"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">\u00a0Catch all<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>  try\n  {\n\n  }\n  catch (\\Throwable $e)\n  {\n    echo 'Throwable: ' . $e->getMessage();\n  }<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Catch specific<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>  try\n  {\n  }\n  catch (\\Exception $e)\n  {\n    echo 'Exception: ',  $e->getMessage(), \"\\n\";\n  }\n  catch (\\Error $e)\n  {\n    echo 'Error: ',  $e->getMessage(), \"\\n\";\n  }<\/code><\/pre>\n\n\n\n<p>\n&nbsp;\n<\/p>\n\n\n\n<p>\n&nbsp;\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u00a0Catch all Catch specific &nbsp; &nbsp;<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[38],"tags":[],"class_list":["post-1781","post","type-post","status-publish","format-standard","hentry","category-errors"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/1781","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/comments?post=1781"}],"version-history":[{"count":3,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/1781\/revisions"}],"predecessor-version":[{"id":5289,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/1781\/revisions\/5289"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/media?parent=1781"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/categories?post=1781"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/tags?post=1781"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}