{"id":10023,"date":"2011-07-29T07:00:00","date_gmt":"2011-07-29T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2011\/07\/29\/hey-lets-report-errors-only-when-nothing-is-at-stake\/"},"modified":"2011-07-29T07:00:00","modified_gmt":"2011-07-29T07:00:00","slug":"hey-lets-report-errors-only-when-nothing-is-at-stake","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20110729-00\/?p=10023","title":{"rendered":"Hey, let&#039;s report errors only when nothing is at stake!"},"content":{"rendered":"<p><a href=\"http:\/\/blogs.msdn.com\/b\/oldnewthing\/archive\/2009\/12\/10\/9934911.aspx\"> Only an idiot would have parameter validation, and only an idiot would not have it<\/a>. In an attempt to resolve this paradox, commenter Gabe suggested, &#8220;<a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2009\/12\/10\/9934911.aspx#9935139\">When running for your QA department, it should crash immediately; when running for your customer, it should silently keep going<\/a>.&#8221; A similar opinion was expressed by <a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2009\/12\/10\/9934911.aspx#9935213\"> commenter Koro<\/a> and some others.\n This replaces one paradox with another. Under the new regime, your program reports errors only when nothing is at stake. &#8220;Report problems when running in test mode, and ignore problems when running on live data.&#8221; Isn&#8217;t this backwards? Shouldn&#8217;t we be <i>more<\/i> sensitive to problems with live data than problems with test data? Who cares if test data gets corrupted? That&#8217;s why it&#8217;s test data. But live data&mdash;we should get really concerned when there&#8217;s a problem with live data. Allowing execution to continue means that you&#8217;re attempting to <a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2009\/11\/13\/9921676.aspx\"> reason about a total breakdown of normal functioning<\/a>.<\/p>\n<p> Now, if your program is mission-critical, you probably have some recovery code that attempts to reset your data structures to a &#8220;last known good&#8221; state or which attempts to salvage what information it can, like how those space probes have a <i>safe mode<\/i>. And that&#8217;s great. But silently ignoring the condition means that your program is going to skip happily along, unaware that what it&#8217;s doing is probably taking a bad situation and subtly making it slightly worse. Eventually, things will get so bad that <a href=\"http:\/\/technet.microsoft.com\/en-us\/magazine\/2009.04.windowsconfidential.aspx\"> something catastrophic happens<\/a>, and when you go to debug the catastrophic failure, you&#8217;ll have no idea how it got that way. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Only an idiot would have parameter validation, and only an idiot would not have it. In an attempt to resolve this paradox, commenter Gabe suggested, &#8220;When running for your QA department, it should crash immediately; when running for your customer, it should silently keep going.&#8221; A similar opinion was expressed by commenter Koro and some [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[26],"class_list":["post-10023","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-other"],"acf":[],"blog_post_summary":"<p>Only an idiot would have parameter validation, and only an idiot would not have it. In an attempt to resolve this paradox, commenter Gabe suggested, &#8220;When running for your QA department, it should crash immediately; when running for your customer, it should silently keep going.&#8221; A similar opinion was expressed by commenter Koro and some [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/10023","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=10023"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/10023\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=10023"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=10023"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=10023"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}