{"id":28844,"date":"2018-10-09T13:38:12","date_gmt":"2018-10-09T11:38:12","guid":{"rendered":"https:\/\/mamchenkov.net\/wordpress\/?p=28844"},"modified":"2018-10-09T13:38:12","modified_gmt":"2018-10-09T11:38:12","slug":"7-tips-to-write-exceptions-everyone-will-love","status":"publish","type":"post","link":"https:\/\/mamchenkov.net\/wordpress\/2018\/10\/09\/7-tips-to-write-exceptions-everyone-will-love\/","title":{"rendered":"7 Tips to Write Exceptions Everyone Will Love"},"content":{"rendered":"<!-- google_ad_section_start -->\n<p>Tomas Votruba shares the &#8220;<a href=\"https:\/\/www.tomasvotruba.cz\/blog\/2018\/09\/17\/7-tips-to-write-exceptions-everyone-will-love\/\">7 Tips to Write Exceptions Everyone Will Love<\/a>&#8220;.\u00a0 These all make a lot of sense and are generic enough to be applicable to any programming language (that implements exceptions).\u00a0 The list of tips is as follows:<\/p>\n<ol>\n<li>Make Exception Names for Humans<\/li>\n<li>Use Quotes Around Statements<\/li>\n<li>What Exactly is Wrong?<\/li>\n<li>What is The Wrong Value?<\/li>\n<li>What File Exactly is Broken?<\/li>\n<li>What Options do I have?<\/li>\n<li>Link what You can&#8217;t Fit 140 Chars<\/li>\n<\/ol>\n<p>Read the full article for both good and bad examples, as well as the explanations of the above.<\/p>\n<!-- google_ad_section_end -->\n","protected":false},"excerpt":{"rendered":"<!-- google_ad_section_start -->\n<p>Tomas Votruba shares the &#8220;7 Tips to Write Exceptions Everyone Will Love&#8220;.\u00a0 These all make a lot of sense and are generic enough to be applicable to any programming language (that implements exceptions).\u00a0 The list of tips is as follows: Make Exception Names for Humans Use Quotes Around Statements What Exactly is Wrong? What is &hellip; <a href=\"https:\/\/mamchenkov.net\/wordpress\/2018\/10\/09\/7-tips-to-write-exceptions-everyone-will-love\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">7 Tips to Write Exceptions Everyone Will Love<\/span><\/a><\/p>\n<!-- google_ad_section_end -->\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_links_to":"","_links_to_target":""},"categories":[1,18,62,1334],"tags":[3069,1330],"keyring_services":[],"class_list":["post-28844","post","type-post","status-publish","format-standard","hentry","category-general","category-programming","category-technology","category-web-work","tag-best-practices","tag-web-development"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":22179,"url":"https:\/\/mamchenkov.net\/wordpress\/2014\/07\/12\/sentry-an-event-logging-platform-focused-on-capturing-and-aggregating-exceptions\/","url_meta":{"origin":28844,"position":0},"title":"Sentry &#8211; an event logging platform focused on capturing and aggregating exceptions","author":"Leonid Mamchenkov","date":"July 12, 2014","format":"link","excerpt":"Sentry - an event logging platform focused on capturing and aggregating exceptions. \u00a0Most of the code is Open Source (except for a few proprietary plugins), in case you want to run your own hosted version. Supports Ruby, Python, JavaScript, Java, Rails, Django, PHP, iOS, node.js, .NET, and more.","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"sentry","src":"https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2014\/07\/sentry-500x182.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":24640,"url":"https:\/\/mamchenkov.net\/wordpress\/2015\/08\/24\/exceptions-and-errors-in-php-7\/","url_meta":{"origin":28844,"position":1},"title":"Exceptions and Errors in PHP 7","author":"Leonid Mamchenkov","date":"August 24, 2015","format":false,"excerpt":"\"An Exceptional Change in PHP 7.0\" blog post describes nicely what are the changes to exceptions and error handling in the upcoming PHP 7. \u00a0Among simple descriptions, there is this reference chart: Very handy!","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":27042,"url":"https:\/\/mamchenkov.net\/wordpress\/2016\/12\/02\/php-7-1-0-released\/","url_meta":{"origin":28844,"position":2},"title":"PHP 7.1.0 Released!","author":"Leonid Mamchenkov","date":"December 2, 2016","format":false,"excerpt":"PHP 7.1.0 release is out, bringing quite a bit of new features and improvements. \u00a0Here are some of the new things: Nullable types Void return type Iterable pseudo-type Class constant visiblity modifiers Square bracket syntax for list() and the ability to specify keys in list() Catching multiple exceptions types Many\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":36383,"url":"https:\/\/mamchenkov.net\/wordpress\/2019\/02\/27\/intro-to-basic-web-application-security\/","url_meta":{"origin":28844,"position":3},"title":"Intro to basic web application security","author":"Leonid Mamchenkov","date":"February 27, 2019","format":false,"excerpt":"\"Intro to basic web application security\" is an excellent overview of the most common mistakes web developers make when it comes to security. The article provides practical examples (including code snippets and screenshots), which illustrate the problems and ways to solve them. The list includes: SQL injection (of course! no\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2019\/02\/security.jpg?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2019\/02\/security.jpg?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2019\/02\/security.jpg?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2019\/02\/security.jpg?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":7906,"url":"https:\/\/mamchenkov.net\/wordpress\/2004\/09\/14\/port-forwarding-with-putty\/","url_meta":{"origin":28844,"position":4},"title":"Port forwarding with Putty","author":"Leonid Mamchenkov","date":"September 14, 2004","format":false,"excerpt":"Putty, it seems, is the most popular Telnet\/SSH client for MS Windows (although it does run UNIX too). It is small, free, stable, and flexible. It has all the functionality one will ever need (with a few exceptions, of course). Secure Shell (SSH) provides for a number of interesting uses.\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":28847,"url":"https:\/\/mamchenkov.net\/wordpress\/2018\/10\/09\/php-safe-and-rector\/","url_meta":{"origin":28844,"position":5},"title":"PHP Safe and Rector","author":"Leonid Mamchenkov","date":"October 9, 2018","format":false,"excerpt":"I came across a couple of very interesting PHP libraries today. The first one is\u00a0thecodingmachine\/safe.\u00a0 This library wraps all PHP functions that return false on failure into another function that throws the exception instead. Think of all those file_get_contents() and json_decode() situations you had to code around.\u00a0 Not anymore.\u00a0 You\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/28844","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/comments?post=28844"}],"version-history":[{"count":0,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/28844\/revisions"}],"wp:attachment":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/media?parent=28844"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/categories?post=28844"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/tags?post=28844"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/keyring_services?post=28844"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}