{"id":14214,"date":"2014-06-23T02:10:46","date_gmt":"2014-06-22T20:40:46","guid":{"rendered":"https:\/\/2thenew.online\/blog\/?p=14214"},"modified":"2014-06-23T09:48:38","modified_gmt":"2014-06-23T04:18:38","slug":"defining-custom-errors-nodejs","status":"publish","type":"post","link":"https:\/\/2thenew.online\/blog\/defining-custom-errors-nodejs\/","title":{"rendered":"Defining custom errors &#8211; NodeJS"},"content":{"rendered":"<p>Any well written piece of code should be defensive by nature with defensive <strong>error handling<\/strong> understanding that things could go wrong. Things would be great if we can define our own <em><strong>custom error classes<\/strong><\/em> which we can pass or throw in order to distinguish various errors.\u00a0<strong>Custom error constructors helps in:<\/strong><\/p>\n<ul style=\"padding-left: 10px\">\n<li>\u21d2&nbsp;&nbsp; Identifying which error was thrown via compliance with <strong><em>instanceof<\/em><\/strong><\/li>\n<li>\u21d2&nbsp;&nbsp; Standardize\u00a0error message format and abstract message building at a central place making it more DRY.<\/li>\n<li>\u21d2&nbsp;&nbsp; Encapsulate additional data and information.<\/li>\n<li>\u21d2&nbsp;&nbsp; More readable, manageable and streamlined <em>Error Handling<\/em>.<\/li>\n<\/ul>\n<p><\/br><\/p>\n<h2 style=\"font-size:26px\">Building My Custom Error Class (Constructor)<\/h2>\n<p>Suppose we need to define a custom error named <strong>ValueOutOfRangeError<\/strong> which we will produce in case the values passed\/retrieved are not within a specific range.<\/p>\n<p>Lets see what all we need to do in order to define custom errors:<\/p>\n<h3>STEP 1: Make a file which will define the error.<\/h3>\n<p>Create a file with the name <strong>ValueOutOfRangeError.js<\/strong>. You can give any other name to the file, but its best recommended practice to name the file with the name of the constructor\/class they export.<\/p>\n<h3>STEP 2: Add a basic constructor function.<\/h3>\n<p>Make a constructor function which takes the desired arguments and sets the message property of the object. Then export it.<br \/>\n[javascript]<br \/>\n\/\/FILE ValueOutOfRangeError.js<br \/>\n&quot;use strict&quot;;<br \/>\n\/**<br \/>\n * Error Class ValueOutOfRangeError<br \/>\n * *\/<br \/>\nfunction ValueOutOfRangeError(propertyName, actualValue, rangeMin, rangeMax) {<br \/>\n    \/\/Set the name for the ERROR<br \/>\n    this.name = this.constructor.name; \/\/set our function\u2019s name as error name.<\/p>\n<p>    \/\/Define error message<br \/>\n    this.message = [<br \/>\n                     &quot;Property with name |&quot;,<br \/>\n                      propertyName ,<br \/>\n                      &quot;| contains the value&quot;,<br \/>\n                      actualValue,<br \/>\n                      &quot;which is outside the range:&quot;,<br \/>\n                      rangeMin, &quot;to&quot;, rangeMax<br \/>\n                   ].join(&quot; &quot;); \/\/Concat and make a string.<br \/>\n}<\/p>\n<p>\/\/Export the constructor function as the export of this module file.<br \/>\nexports = module.exports = ValueOutOfRangeError;<\/p>\n<p>[\/javascript]<\/p>\n<h3>STEP 3: Inherit from native Error class.<\/h3>\n<p>Lets inherit from the <strong>Error<\/strong> native constructor such that our new custom error constructor is an actual error object.<br \/>\n[javascript]<br \/>\n\/\/FILE ValueOutOfRangeError.js<br \/>\n&quot;use strict&quot;;<\/p>\n<p>\/\/Utils module loaded<br \/>\nvar util = require(&#8216;util&#8217;);<\/p>\n<p>\/**<br \/>\n * Error Class ValueOutOfRangeError<br \/>\n * *\/<br \/>\nfunction ValueOutOfRangeError(propertyName, actualValue, rangeMin, rangeMax) {<\/p>\n<p>    \/*INHERITANCE*\/<br \/>\n    Error.call(this); \/\/super constructor<br \/>\n    Error.captureStackTrace(this, this.constructor); \/\/super helper method to include stack trace in error object<\/p>\n<p>    \/\/Set the name for the ERROR<br \/>\n    this.name = this.constructor.name; \/\/set our function\u2019s name as error name.<\/p>\n<p>    \/\/Define error message<br \/>\n    this.message = [<br \/>\n                     &quot;Property with name |&quot;,<br \/>\n                      propertyName ,<br \/>\n                      &quot;| contains the value&quot;,<br \/>\n                      actualValue,<br \/>\n                      &quot;which is outside the range:&quot;,<br \/>\n                      rangeMin, &quot;to&quot;, rangeMax<br \/>\n                   ].join(&quot; &quot;); \/\/Concat and make a string.<br \/>\n}<\/p>\n<p>\/\/ inherit from Error<br \/>\nutil.inherits(ValueOutOfRangeError, Error);<\/p>\n<p>\/\/Export the constructor function as the export of this module file.<br \/>\nexports = module.exports = ValueOutOfRangeError;<\/p>\n<p>[\/javascript]<\/p>\n<h3>STEP 4: Yeahh! All done. We have our first custom-error file in place:).<\/h3>\n<h2 style=\"font-size:26px\">Using the custom-errors!<\/h2>\n<p>Now lets see how we can use our <strong>ValueOutOfRangeError<\/strong> class which we defined above.<br \/>\n[javascript]<br \/>\n\/\/Load the custom error.<br \/>\nvar ValueOutOfRangeError = require(&quot;.\/ValueOutOfRangeError&quot;);<\/p>\n<p>\/\/THROWING EXAMPLE<br \/>\nif(\/*error check fails*\/) throw new ValueOutOfRangeError(&quot;theAwesomeProperty&quot;, data.theAwesomeProperty, 10, 100);<\/p>\n<p>\/\/EXAMPLE RETURN VALUE<br \/>\nif(\/*error check fails*\/) callback(new ValueOutOfRangeError(&quot;theAwesomeProperty&quot;, data.theAwesomeProperty, 10, 100));<\/p>\n<p>[\/javascript]<\/p>\n<p>Hope that helps!! \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Any well written piece of code should be defensive by nature with defensive error handling understanding that things could go wrong. Things would be great if we can define our own custom error classes which we can pass or throw in order to distinguish various errors.\u00a0Custom error constructors helps in: \u21d2&nbsp;&nbsp; Identifying which error was [&hellip;]<\/p>\n","protected":false},"author":28,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":5,"footnotes":""},"categories":[1185],"tags":[1447,55,1156,1124,1177],"class_list":["post-14214","post","type-post","status-publish","format-standard","hentry","category-node-js-2","tag-error-handling","tag-javascript","tag-node","tag-node-js","tag-nodejs-2"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"Any well written piece of code should be defensive by nature with defensive error handling understanding that things could go wrong. Things would be great if we can define our own custom error classes which we can pass or throw in order to distinguish various errors. Custom error constructors helps in: \u21d2 Identifying which error was\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Kushal Likhi\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/2thenew.online\/blog\/defining-custom-errors-nodejs\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"TO THE NEW BLOG\" \/>\n\t\t<meta property=\"og:type\" content=\"blog\" \/>\n\t\t<meta property=\"og:title\" content=\"Defining custom errors \u2013 NodeJS | TO THE NEW Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"Any well written piece of code should be defensive by nature with defensive error handling understanding that things could go wrong. Things would be great if we can define our own custom error classes which we can pass or throw in order to distinguish various errors. Custom error constructors helps in: \u21d2 Identifying which error was\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/2thenew.online\/blog\/defining-custom-errors-nodejs\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/2thenew.online\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/2thenew.online\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@tothenew\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Defining custom errors \u2013 NodeJS | TO THE NEW Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Any well written piece of code should be defensive by nature with defensive error handling understanding that things could go wrong. Things would be great if we can define our own custom error classes which we can pass or throw in order to distinguish various errors. Custom error constructors helps in: \u21d2 Identifying which error was\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/2thenew.online\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/defining-custom-errors-nodejs\\\/#article\",\"name\":\"Defining custom errors \\u2013 NodeJS | TO THE NEW Blog\",\"headline\":\"Defining custom errors &#8211; NodeJS\",\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/kushal\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"},\"datePublished\":\"2014-06-23T02:10:46+05:30\",\"dateModified\":\"2014-06-23T09:48:38+05:30\",\"inLanguage\":\"en-US\",\"commentCount\":1,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/defining-custom-errors-nodejs\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/defining-custom-errors-nodejs\\\/#webpage\"},\"articleSection\":\"Node.js, Error Handling, javascript, node, node.js, nodejs\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/defining-custom-errors-nodejs\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/node-js-2\\\/#listItem\",\"name\":\"Node.js\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/node-js-2\\\/#listItem\",\"position\":2,\"name\":\"Node.js\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/node-js-2\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/defining-custom-errors-nodejs\\\/#listItem\",\"name\":\"Defining custom errors &#8211; NodeJS\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/defining-custom-errors-nodejs\\\/#listItem\",\"position\":3,\"name\":\"Defining custom errors &#8211; NodeJS\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/node-js-2\\\/#listItem\",\"name\":\"Node.js\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\",\"name\":\"TO THE NEW Blog\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/kushal\\\/#author\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/kushal\\\/\",\"name\":\"Kushal Likhi\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/defining-custom-errors-nodejs\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9311812a092d64f47eb30d7ad28378cfae924a0cac140ffbb686fcd8a565a57e?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Kushal Likhi\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/defining-custom-errors-nodejs\\\/#webpage\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/defining-custom-errors-nodejs\\\/\",\"name\":\"Defining custom errors \\u2013 NodeJS | TO THE NEW Blog\",\"description\":\"Any well written piece of code should be defensive by nature with defensive error handling understanding that things could go wrong. Things would be great if we can define our own custom error classes which we can pass or throw in order to distinguish various errors. Custom error constructors helps in: \\u21d2 Identifying which error was\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/defining-custom-errors-nodejs\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/kushal\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/kushal\\\/#author\"},\"datePublished\":\"2014-06-23T02:10:46+05:30\",\"dateModified\":\"2014-06-23T09:48:38+05:30\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\",\"name\":\"TO THE NEW Blog\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Defining custom errors \u2013 NodeJS | TO THE NEW Blog","description":"Any well written piece of code should be defensive by nature with defensive error handling understanding that things could go wrong. Things would be great if we can define our own custom error classes which we can pass or throw in order to distinguish various errors. Custom error constructors helps in: \u21d2 Identifying which error was","canonical_url":"https:\/\/2thenew.online\/blog\/defining-custom-errors-nodejs\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/2thenew.online\/blog\/defining-custom-errors-nodejs\/#article","name":"Defining custom errors \u2013 NodeJS | TO THE NEW Blog","headline":"Defining custom errors &#8211; NodeJS","author":{"@id":"https:\/\/2thenew.online\/blog\/author\/kushal\/#author"},"publisher":{"@id":"https:\/\/2thenew.online\/blog\/#organization"},"datePublished":"2014-06-23T02:10:46+05:30","dateModified":"2014-06-23T09:48:38+05:30","inLanguage":"en-US","commentCount":1,"mainEntityOfPage":{"@id":"https:\/\/2thenew.online\/blog\/defining-custom-errors-nodejs\/#webpage"},"isPartOf":{"@id":"https:\/\/2thenew.online\/blog\/defining-custom-errors-nodejs\/#webpage"},"articleSection":"Node.js, Error Handling, javascript, node, node.js, nodejs"},{"@type":"BreadcrumbList","@id":"https:\/\/2thenew.online\/blog\/defining-custom-errors-nodejs\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/2thenew.online\/blog#listItem","position":1,"name":"Home","item":"https:\/\/2thenew.online\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/2thenew.online\/blog\/category\/node-js-2\/#listItem","name":"Node.js"}},{"@type":"ListItem","@id":"https:\/\/2thenew.online\/blog\/category\/node-js-2\/#listItem","position":2,"name":"Node.js","item":"https:\/\/2thenew.online\/blog\/category\/node-js-2\/","nextItem":{"@type":"ListItem","@id":"https:\/\/2thenew.online\/blog\/defining-custom-errors-nodejs\/#listItem","name":"Defining custom errors &#8211; NodeJS"},"previousItem":{"@type":"ListItem","@id":"https:\/\/2thenew.online\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/2thenew.online\/blog\/defining-custom-errors-nodejs\/#listItem","position":3,"name":"Defining custom errors &#8211; NodeJS","previousItem":{"@type":"ListItem","@id":"https:\/\/2thenew.online\/blog\/category\/node-js-2\/#listItem","name":"Node.js"}}]},{"@type":"Organization","@id":"https:\/\/2thenew.online\/blog\/#organization","name":"TO THE NEW Blog","url":"https:\/\/2thenew.online\/blog\/"},{"@type":"Person","@id":"https:\/\/2thenew.online\/blog\/author\/kushal\/#author","url":"https:\/\/2thenew.online\/blog\/author\/kushal\/","name":"Kushal Likhi","image":{"@type":"ImageObject","@id":"https:\/\/2thenew.online\/blog\/defining-custom-errors-nodejs\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/9311812a092d64f47eb30d7ad28378cfae924a0cac140ffbb686fcd8a565a57e?s=96&d=mm&r=g","width":96,"height":96,"caption":"Kushal Likhi"}},{"@type":"WebPage","@id":"https:\/\/2thenew.online\/blog\/defining-custom-errors-nodejs\/#webpage","url":"https:\/\/2thenew.online\/blog\/defining-custom-errors-nodejs\/","name":"Defining custom errors \u2013 NodeJS | TO THE NEW Blog","description":"Any well written piece of code should be defensive by nature with defensive error handling understanding that things could go wrong. Things would be great if we can define our own custom error classes which we can pass or throw in order to distinguish various errors. Custom error constructors helps in: \u21d2 Identifying which error was","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/2thenew.online\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/2thenew.online\/blog\/defining-custom-errors-nodejs\/#breadcrumblist"},"author":{"@id":"https:\/\/2thenew.online\/blog\/author\/kushal\/#author"},"creator":{"@id":"https:\/\/2thenew.online\/blog\/author\/kushal\/#author"},"datePublished":"2014-06-23T02:10:46+05:30","dateModified":"2014-06-23T09:48:38+05:30"},{"@type":"WebSite","@id":"https:\/\/2thenew.online\/blog\/#website","url":"https:\/\/2thenew.online\/blog\/","name":"TO THE NEW Blog","inLanguage":"en-US","publisher":{"@id":"https:\/\/2thenew.online\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"TO THE NEW BLOG","og:type":"blog","og:title":"Defining custom errors \u2013 NodeJS | TO THE NEW Blog","og:description":"Any well written piece of code should be defensive by nature with defensive error handling understanding that things could go wrong. Things would be great if we can define our own custom error classes which we can pass or throw in order to distinguish various errors. Custom error constructors helps in: \u21d2 Identifying which error was","og:url":"https:\/\/2thenew.online\/blog\/defining-custom-errors-nodejs\/","og:image":"https:\/\/2thenew.online\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","og:image:secure_url":"https:\/\/2thenew.online\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","twitter:card":"summary","twitter:site":"@tothenew","twitter:title":"Defining custom errors \u2013 NodeJS | TO THE NEW Blog","twitter:description":"Any well written piece of code should be defensive by nature with defensive error handling understanding that things could go wrong. Things would be great if we can define our own custom error classes which we can pass or throw in order to distinguish various errors. Custom error constructors helps in: \u21d2 Identifying which error was","twitter:image":"https:\/\/2thenew.online\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png"},"aioseo_meta_data":{"post_id":"14214","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"created":"2021-04-29 22:50:36","updated":"2024-02-29 09:33:28","focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/2thenew.online\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/2thenew.online\/blog\/category\/node-js-2\/\" title=\"Node.js\">Node.js<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tDefining custom errors \u2013 NodeJS\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/2thenew.online\/blog"},{"label":"Node.js","link":"https:\/\/2thenew.online\/blog\/category\/node-js-2\/"},{"label":"Defining custom errors &#8211; NodeJS","link":"https:\/\/2thenew.online\/blog\/defining-custom-errors-nodejs\/"}],"_links":{"self":[{"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/posts\/14214","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/users\/28"}],"replies":[{"embeddable":true,"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/comments?post=14214"}],"version-history":[{"count":0,"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/posts\/14214\/revisions"}],"wp:attachment":[{"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/media?parent=14214"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/categories?post=14214"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/2thenew.online\/blog\/wp-json\/wp\/v2\/tags?post=14214"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}