top of page
Search
andreybeck

Boneheaded



"Attacking Disney, threatening to harm our state's economic powerhouse that creates so many jobs and brings in so many tourism dollars is a boneheaded move however you look at it. Ron's a threat to our state's economy and he's gotta go in November," Crist said in the tweet on Friday.




boneheaded



I am confused because in quite a few places I've already read that the so-called 'boneheaded' exceptions (ones that result from bugs in code) are not supposed to be caught. Instead, they must be allowed to crash the application:


Why am I asking - I'm perpetually trying to finish a hobby project, which is a browser based game in .net core. As far as I'm aware, in many cases the framework does for me out of the box the precise thing Eric Lippert and Stephen Cleary are recommending against! - that is, if handling a request throws, the framework automatically catches the exception and prevents the server from crashing. In a few places, however, the framework does not do this. In such places, I am wrapping my own code with try ... catch ... to catch all possible 'boneheaded' exceptions.


That's all there is to it. Calling an exception boneheaded is just being pointlessly rude. In some contexts you simply don't know what will happen to system state when you fail, so you throw and let the calling code figure it out. If the calling code can't figure it out then you crash and let the operator figure it out.


The confusion is because the articles are not clear about what it actually means to "catch" or "crash". If we followed advice never to catch "boneheaded exceptions", then a single application bug should bubble up and cause the whole operating system to crash. This is not what anybody wants!


Catching a boneheaded exception in your own code does not really make any sense. A boneheaded exceptions means there is an unexpected bug in the section of code. In other words, the code does something wrong, but you don't know exactly what or why. At best nothing happens when you execute the code, at worst some state is corrupted which might cause other parts of the system to behave erroneously and corrupt more state.


So for a client, crashing is not at all a bad response to a boneheaded exception. For a server, it is a much worse response. Still, you have to weigh up: You have an exception that is totally unexpected to you. You have no idea how to handle it properly (reporting an exception isn't handling it). How much damage could be done by continuing when you know something has gone badly wrong? So do you want to continue operations, with unknown and potentially unlimited damages, do you want to crash the server, causing some damage, or do you want to restart the server (not quite crashing, but restarting it as gentle as possible).


In the unfortunate situation that a boneheaded exceptions is thrown, i want to inform the user, so that he will report the bug to us (third level support). In addition, I want to log a message with log level "Error" in this case.


Is this a common and good practices to distinguish between boneheaded exceptions and exogenous exceptions in enterprise applications? Is there a better approach? Or is it not necessary at all?


After reading this article dotnetpro - Implementierungsausnahmen I am also wondering, if I should wrap all (also boneheaded) exceptions into custom exceptions to provide more context information when logging them?


Similarly, just because we catch an exception explicitly doesn't guarantee that it's not "boneheaded." Maybe I'm doing something wrong, and sometimes my code throws ObjectDisposedException. I have no idea why it does that, so I add catch(ObjectExposedException ex). At first glance it might look like I know what's going on in my code, but I really don't. I should have figured out the problem and fixed it instead of catching an exception without having any idea why it happens. If the application doesn't work once in a while and I don't know why, the fact that I caught an exception is at best useless or at worst harmful because it hides what's really going on.


This is not to say that we should add try/catch statements in every single method to catch "boneheaded" exceptions. That's just an example of exception handling that accounts for the possibility of an exception which may or may not have been a mistake. It's usually not useful to do that in every method. We might put just enough around the edges to make sure that any exception thrown will at least get logged.


Australian Nick Kyrgios has labelled the decision to go ahead with the Adria Tour as "boneheaded" after Borna Coric became the second tennis player to confirm that he tested positive for the coronavirus on Monday.


Your email is safe with us, we don\u2019t spam. Cancel anytime.\r\n \r\n\r\n \r\n Sign Up\r\n \r\n \r\n \r\n \r\n \r\n\r\n\r\n \r\n","once_per_page":1,"debugmode":false,"blog_id":1,"type":"plain","position":"","tracking_enabled":true,"privacy":"ignore":false,"needs_consent":false}}},"2355301_5":"elementid":["rolli-1b3ae6fb243e853a252e09d53bb243b9"],"ads":"2355301":"id":2355301,"title":"ad9999 Taboola bottom of story content recommendation","expiry_date":0,"visitors":[],"content":"\r\n\r\n\r\n\r\n\r\n window._taboola = window._taboola ,"2373862_11":"elementid":["rolli-a31760a1b7a87f39480c7a9111f60782"],"ads":"2373862": ; googletag.cmd = googletag.cmd ,"2373862_13":"elementid":["rolli-ccd6dc11aa56e199df52624cdd844ed7"],"ads":"2373862":,"2355301_15":"elementid":["rolli-cf9fab509aef26cfd9c11877e5ba9fe1"],"ads":"2355301":,"1538983_17":"elementid":["rolli-d167c749cea98f49c8a96f0bb05856d1"],"ads":"1538983":};window.advads_passive_groups = "1770_7":"type":"group","id":1770,"elementid":["rolli-f8f33b46a9cf9f2bd2c745c65587925d"],"ads":"2504437":"id":2504437,"title":"Slingshot - URHR Sponsorship","expiry_date":0,"visitors":[],"content":"","once_per_page":0,"debugmode":false,"blog_id":1,"type":"plain","position":"none","tracking_enabled":true,"privacy":"ignore":false,"needs_consent":false,"group_info":"id":1770,"name":"Upper Right Hand Rail Sponsorship","weights":"2504437":10,"type":"default","ordered_ad_ids":[2504437],"ad_count":1,"1772_9":"type":"group","id":1772,"elementid":["rolli-83c5b6ac0a4a44faed0ea6be2fe0c89b"],"ads":"2497676":"id":2497676,"title":"000 - Entertainment Newsletter","expiry_date":0,"visitors":[],"content":"\r\n\r\n \r\n Sign up for our free Thursday Entertainment newsletter!\r\n\r\n \r\n \r\n\r\n \r\n \r\n \r\n\t Your email is safe with us, we don\u2019t spam. Cancel anytime.\r\n \r\n\r\n \r\n Sign Up\r\n \r\n \r\n \r\n \r\n \r\n\r\n\r\n \r\n","once_per_page":1,"debugmode":false,"blog_id":1,"type":"plain","position":"","tracking_enabled":true,"privacy":"ignore":false,"needs_consent":false,"group_info":"id":1772,"name":"email newsletter signups in stories","weights":"2499786":0,"2437177":10,"2523932":10,"2497676":10,"2508377":10,"type":"default","ordered_ad_ids":[2508377,2523932,2437177,2497676],"ad_count":5,"refresh_enabled":true,"refresh_interval_for_ads":"2497676":5000,"2437177":5000,"2523932":5000,"2508377":5000;window.advads_ajax_queries = ["id":"amp-header","method":"placement","params":"cache-busting":"auto","previous_method":"placement","previous_id":"amp-header","post":"r0","url_parameter":"\/2462749\/john-cena-hits-the-small-screen-as-a-boneheaded-misguided-dc-superhero.html","placement_type":"header","output":"placement_id":"amp-header","blog_id":1,"id":"header","method":"placement","params":"placement_conditions":"display":["type":"posttypes","operator":"is","value":["page"]],"visitors":["type":"role","operator":"is_not","value":"subscriber"],"cache-busting":"auto","previous_method":"placement","previous_id":"header","post":"r0","url_parameter":"\/2462749\/john-cena-hits-the-small-screen-as-a-boneheaded-misguided-dc-superhero.html","placement_type":"header","output":"placement_id":"header","change-ad":"visitors":["type":"role","operator":"is_not","value":"subscriber","connector":"and"],"conditions":["type":"posttypes","operator":"is","value":["page"],"connector":"and"],"blog_id":1,"id":"after-content","method":"placement","params":"ad_label":"disabled","placement_clearfix":"1","inline-css":"","pro_minimum_length":"100","placement_conditions":"display":["type":"posttypes","operator":"is","value":["post","page"],"type":"taxonomy_category","operator":"is_not","value":["221","12","1202","886"]],"visitors":["type":"role","operator":"is_not","value":"subscriber"],"lazy_load":"enabled","post":"r0","url_parameter":"\/2462749\/john-cena-hits-the-small-screen-as-a-boneheaded-misguided-dc-superhero.html","placement_type":"post_bottom","elementid":"rolli-7107988f11ad838c94dc9d5c0ce07c86","blog_id":1,"id":"content-middle","method":"placement","params":"ad_label":"enabled","placement_position":"center","inline-css":"","pro_minimum_length":"250","placement_conditions":"display":["type":"posttypes","operator":"is","value":["post"],"type":"taxonomy_category","operator":"is_not","value":["221","12","1202","886"],"connector":"or","type":"amp","operator":"is_not"],"visitors":["type":"role","operator":"is","value":"subscriber","type":"device_width","operator":"is_lower","value":"600"],"placement":"type":"post_content_middle","post":"r0","url_parameter":"\/2462749\/john-cena-hits-the-small-screen-as-a-boneheaded-misguided-dc-superhero.html","placement_type":"post_content_middle","elementid":"rolli-c80f7439d95b69e37730b5e5a0039ad9","blog_id":1,"id":"popup-and-layer-ads","method":"placement","params":"previous_method":"placement","previous_id":"popup-and-layer-ads","post":"r0","url_parameter":"\/2462749\/john-cena-hits-the-small-screen-as-a-boneheaded-misguided-dc-superhero.html","placement_type":"layer","ad_label":"disabled","inline-css":"","layer_placement":"trigger":"","offset":"200","delay_sec":"10","effect":"show","duration":"500","auto_close":"delay":"5","close":"where":"outside","side":"left","timeout":"0","sticky":"assistant":"bottomcenter","position":"width":"0","height":"0","placement_width":"0","placement_height":"0","placement_conditions":"display":["type":"request_uri","operator":"contain_not","value":"my-account","type":"request_uri","operator":"contain_not","value":"subscri","type":"request_uri","operator":"contain_not","value":"forgot-password","value":["is_front_page","is_singular","is_archive","is_search"],"type":"general","type":"request_uri","operator":"contain_not","value":"legal","type":"taxonomy_category","operator":"is_not","value":["1771"],"type":"request_uri","operator":"contain_not","value":"summer-guide","type":"request_uri","operator":"contain_not","value":"\/reset-password"],"visitors":["type":"role","operator":"is_not","value":"subscriber","type":"role","operator":"is_not","value":"editor","type":"referrer_url","operator":"contain","value":""],"cache-busting":"auto","output":"class":["rolli-popup-and-layer-ads"],"placement_id":"popup-and-layer-ads","elementid":"rolli-ce411a9ec0ad2fc33f035a72de9795f1","blog_id":1];window.advads_has_ads = [["2497676","ad","000 - Entertainment Newsletter","off"],["2438006","ad","00 Taboola right rail","off"],["2482306","ad","000-666 adsense","off"]];window.advads_ajax_queries_args = "r0":"id":2462749,"author":"65","post_type":"post";( window.advanced_ads_ready jQuery( document ).ready ).call( null, function() if ( !window.advanced_ads_pro ) console.log("Advanced Ads Pro: cache-busting can not be initialized"); );/* */!function() else getWeather(); function getWeather() jQuery.ajax( url: '/portal.php', dataType: 'json', type: 'post', data: action: 'get_weather_data' , success: function(response) setWeather(response); const now = new Date() const item = info: response, expiry: now.getTime() + 600000, localStorage.setItem('weather', JSON.stringify(item)) ); function setWeather(weather) if (new Array('04d', '04d').includes(weather.weather[0].icon)) icon = ' -content/themes/abq/assets/images/Cloudy.svg'; else if (new Array('01d', '01d').includes(weather.weather[0].icon)) icon = ' -content/themes/abq/assets/images/Sunny.svg'; else if (new Array('02d', '02d').includes(weather.weather[0].icon)) icon = ' -content/themes/abq/assets/images/PartlyCloudy.svg'; else if (new Array('03d', '03d').includes(weather.weather[0].icon)) icon = ' -content/themes/abq/assets/images/Cloudy.svg'; else if (new Array('09d', '09d').includes(weather.weather[0].icon)) icon = ' -content/themes/abq/assets/images/Rainy.svg'; else if (new Array('10d', '10d').includes(weather.weather[0].icon)) icon = ' -content/themes/abq/assets/images/Rainy.svg'; else if (new Array('11d', '11d').includes(weather.weather[0].icon)) icon = ' -content/themes/abq/assets/images/Thundering.svg'; else if (new Array('13d', '13d').includes(weather.weather[0].icon)) icon = ' -content/themes/abq/assets/images/Snowy.svg'; else icon = ' ' + weather.weather[0].icon + '.png'; jQuery('#weather-icon').html(''); jQuery('#weather').html(parseInt(weather.main.temp) + ' F'); jQuery('#weather').parent().attr('title', weather.weather[0].description); window.mobileAndTabletCheck = function() window.opera); return check; ; Share by Email Sharing 2ff7e9595c


0 views0 comments

Recent Posts

See All

Comments


bottom of page