{"id":207,"date":"2010-04-28T19:58:48","date_gmt":"2010-04-28T19:58:48","guid":{"rendered":"https:\/\/ibex.tech\/visualcpp\/?p=207"},"modified":"2022-02-17T06:24:05","modified_gmt":"2022-02-17T06:24:05","slug":"using-error-catching","status":"publish","type":"post","link":"https:\/\/ibex.tech\/visualcpp\/try-error-catching\/using-error-catching","title":{"rendered":"Using Error Catching"},"content":{"rendered":"<h4>Typical Try Catch<\/h4>\n<pre><code>\r\n\ttry\r\n\t{\r\n\r\n\t}\r\n\tcatch (Exception ^e)\r\n\t{\r\n\t\tMessageBox::Show(L\"Error:\\n\" + e, L\"Error\", MessageBoxButtons::OK, MessageBoxIcon::Error);\r\n\t}\r\n<\/code><\/pre>\n<h4>Try Catch Without Error Code<\/h4>\n<pre><code>\r\n\ttry\r\n\t{\r\n\r\n\t}\r\n\tcatch (Exception ^)\r\n\t{\r\n\t}\r\n<\/code><\/pre>\n<h4>Finally<\/h4>\n<pre><code>\r\n\t\/\/The 'finally' section is optional and goes after the catch section(s)\r\n\tfinally\r\n\t{\r\n\t\t\/\/Any code here will always be run, even if the catch returns out of the function.  \r\n\t}\r\n<\/code><\/pre>\n<h4>Throw<\/h4>\n<p>You can use throw in a try block to cause execution to jump out to the catch block, or in a class to cause the calling functions error handler to be invoked.<\/p>\n<pre><code>\r\n\tthrow gcnew Exception(\"ABC\");\t\t\/\/ABC will be displayed as the error message\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Typical Try Catch try { } catch (Exception ^e) { MessageBox::Show(L&#8221;Error:\\n&#8221; + e, L&#8221;Error&#8221;, MessageBoxButtons::OK, MessageBoxIcon::Error); } Try Catch Without Error Code try { } catch (Exception ^) { } Finally \/\/The &#8216;finally&#8217; section is optional and goes after the catch section(s) finally { \/\/Any code here will always be run, even if the catch [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31],"tags":[],"class_list":["post-207","post","type-post","status-publish","format-standard","hentry","category-try-error-catching"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts\/207","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/comments?post=207"}],"version-history":[{"count":3,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts\/207\/revisions"}],"predecessor-version":[{"id":1125,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/posts\/207\/revisions\/1125"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/media?parent=207"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/categories?post=207"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/visualcpp\/wp-json\/wp\/v2\/tags?post=207"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}