{"id":8840,"date":"2014-05-20T13:07:51","date_gmt":"2014-05-20T17:07:51","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=8840"},"modified":"2014-05-20T13:07:51","modified_gmt":"2014-05-20T17:07:51","slug":"trapping-javascript-errors","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2014\/05\/20\/trapping-javascript-errors\/","title":{"rendered":"Trapping JavaScript Errors"},"content":{"rendered":"<p><a href=\"http:\/\/indiestack.com\/2014\/05\/javascript-bug-traps\/\">Daniel Jalkut<\/a>:<\/p>\n<blockquote cite=\"http:\/\/indiestack.com\/2014\/05\/javascript-bug-traps\/\"><p>On the other hand, <a href=\"http:\/\/www.red-sweater.com\/marsedit\/\">MarsEdit<\/a> features a rich HTML text editor largely implemented in JavaScript, a language which tends not to afford any of these convenient alerts to my mistakes. I have often stared in bewilderment as the editor window&rsquo;s perplexing behavior, only to discover after many lost minutes or hours, that some subtle JavaScript error has been preventing the expected behavior of my code. I&rsquo;ll switch to the WebKit inspector for the affected WebView, and discover the console is littered with red: errors being dutifully logged by the JavaScript runtime, but ignored by everybody.<\/p>\n<p><em>Wouldn&rsquo;t it be great if the JavaScript code crashed as hard as the Objective-C code does?<\/em><\/p><\/blockquote>\n<p>His solution is to add a JavaScript event listener that reports errors to the Objective-C delegate object.<\/p>","protected":false},"excerpt":{"rendered":"<p>Daniel Jalkut: On the other hand, MarsEdit features a rich HTML text editor largely implemented in JavaScript, a language which tends not to afford any of these convenient alerts to my mistakes. I have often stared in bewilderment as the editor window&rsquo;s perplexing behavior, only to discover after many lost minutes or hours, that some [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[69,346,30,54,71,328],"class_list":["post-8840","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-cocoa","tag-javascript","tag-mac","tag-objective-c","tag-programming","tag-webkit"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/8840","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=8840"}],"version-history":[{"count":0,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/8840\/revisions"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=8840"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=8840"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=8840"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}