{"id":1221,"date":"2023-09-07T09:00:00","date_gmt":"2023-09-07T09:00:00","guid":{"rendered":"https:\/\/www.naveedulhaq.com\/?p=1221"},"modified":"2023-09-06T18:49:45","modified_gmt":"2023-09-06T18:49:45","slug":"working-with-custom-exception-in-c","status":"publish","type":"post","link":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/working-with-custom-exception-in-c\/","title":{"rendered":"Working With Custom Exception in C#"},"content":{"rendered":"\n<p>Exception handling is a vital aspect of robust software development. While C# provides a range of built-in exceptions, there are scenarios where you\u2019ll encounter specific errors that demand a more tailored response. That\u2019s where custom exceptions in C# come into play. In this guide, you\u2019ll delve into the world of <a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/csharp\/\" target=\"_blank\" rel=\"noreferrer noopener\">C#<\/a> custom exceptions, discovering how to create, throw, and handle these specialized error classes to enhance your code\u2019s reliability and maintainability.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"understanding-custom-exceptions\"><strong>Understanding Custom Exceptions<\/strong><\/h2>\n\n\n\n<p>In C#, exceptions are a mechanism for handling runtime errors gracefully. The .NET Framework provides a plethora of predefined exceptions that cover common error scenarios, such as divide-by-zero, file not found, or null reference. However, there are situations unique to your application where these standard exceptions might not convey the exact nature of the problem or the necessary context for resolution. This is where custom exceptions shine.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"creating-a-custom-exception\"><strong>Creating Custom Exception<\/strong>s<\/h2>\n\n\n\n<p>Creating a custom exception in C# is straightforward. You derive a new class from the&nbsp;<code>Exception<\/code>&nbsp;base class or any of its subclasses, such as&nbsp;<code>ApplicationException<\/code>. Here\u2019s a simple example of defining a custom exception:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public class MyCustomException : Exception\n{\n    public MyCustomException()\n    {\n    }\n\n    public MyCustomException(string message)\n        : base(message)\n    {\n    }\n\n    public MyCustomException(string message, Exception innerException)\n        : base(message, innerException)\n    {\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>In this example,&nbsp;<code>MyCustomException<\/code>&nbsp;is derived from&nbsp;<code>Exception<\/code>&nbsp;and provides constructors to set the error message and optionally include an inner exception. You can extend this custom exception by adding properties or methods specific to your error scenario.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"throwing-a-custom-exception\"><strong>Throwing Custom Exception<\/strong>s<\/h2>\n\n\n\n<p>Once you\u2019ve created a custom exception, you can throw it using the&nbsp;<code>throw<\/code>&nbsp;keyword when a specific error condition arises in your code. Here\u2019s an example of throwing a custom exception:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public int Divide(int dividend, int divisor)\n{\n    if (divisor == 0)\n    {\n        throw new MyCustomException(\"Division by zero is not allowed.\");\n    }\n\n    return dividend \/ divisor;\n}\n<\/code><\/pre>\n\n\n\n<p>In this method, if&nbsp;<code>divisor<\/code>&nbsp;is zero, a&nbsp;<code>MyCustomException<\/code>&nbsp;is thrown with a descriptive error message.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"handling-custom-exceptions\"><strong>Handling Custom Exceptions<\/strong><\/h2>\n\n\n\n<p>Handling custom exceptions is similar to handling built-in exceptions. You use&nbsp;<code>try-catch<\/code>&nbsp;blocks to catch and respond to exceptions. Here\u2019s an example of catching and handling a custom exception:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>try\n{\n    int result = Divide(10, 0);\n}\ncatch (MyCustomException ex)\n{\n    Console.WriteLine($\"Custom Exception: {ex.Message}\");\n}\ncatch (Exception ex)\n{\n    Console.WriteLine($\"An unexpected error occurred: {ex.Message}\");\n}\n<\/code><\/pre>\n\n\n\n<p>In this example, the&nbsp;<code>Divide<\/code>&nbsp;method throws a&nbsp;<code>MyCustomException<\/code>&nbsp;when dividing by zero. The first catch block specifically handles&nbsp;<code>MyCustomException<\/code>, allowing you to provide a custom response. The second catch block serves as a fallback to handle any unexpected exceptions.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"benefits-of-custom-exceptions\"><strong>Benefits of Custom Exceptions<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Clarity:<\/strong>&nbsp;Custom exceptions provide clear and meaningful error messages that make debugging and troubleshooting easier.<\/li>\n\n\n\n<li><strong>Context:<\/strong>&nbsp;You can include additional information in custom exceptions, helping you pinpoint the cause of errors more effectively.<\/li>\n\n\n\n<li><strong>Control:<\/strong>\u00a0Custom exceptions allow you to control error-handling behavior specific to your application\u2019s needs.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"real-world-scenario-authentication\"><strong>Real-World Scenario: Authentication<\/strong><\/h2>\n\n\n\n<p>Imagine you\u2019re developing an authentication module for a web application. If a user enters an incorrect password, you can throw a custom&nbsp;<code>InvalidPasswordException<\/code>&nbsp;with a message tailored to the authentication process. This enables you to distinguish authentication-related errors from other exceptions and respond accordingly.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"conclusion\"><strong>Conclusion<\/strong><\/h2>\n\n\n\n<p>C# custom exceptions empower you to handle errors with precision and clarity. By creating, throwing, and handling custom exceptions, you can enhance your code\u2019s reliability and maintainability, ensuring that errors are caught, properly understood, and resolved. Whether you\u2019re developing a small application or a large-scale system, custom exceptions are valuable for effective error management and graceful degradation in the face of unexpected circumstances.<\/p>\n\n\n\n<p><a href=\"https:\/\/www.naveedulhaq.com\/index.php\/category\/dot-net-core\/\" target=\"_blank\" rel=\"noreferrer noopener\">Read more C#\/.NET Tutorials Here!<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Exception handling is a vital aspect of robust software development. While C# provides a range of built-in exceptions, there are scenarios where you\u2019ll encounter specific&#8230;<\/p>\n","protected":false},"author":3,"featured_media":641,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[11,8,62,37,32,23,56],"class_list":["post-1221","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dot-net-core","tag-dot-net-core","tag-dot-net-framework","tag-asp-net","tag-c","tag-developer","tag-development","tag-visual-studio"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Working With Custom Exception in C# - Naveed Ul-Haq&#039;s blog<\/title>\n<meta name=\"description\" content=\"C# Custom Exception enhances your code\u2019s reliability and maintainability, ensuring that errors are caught, properly understood, and resolved.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/working-with-custom-exception-in-c\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Working With Custom Exception in C# - Naveed Ul-Haq&#039;s blog\" \/>\n<meta property=\"og:description\" content=\"C# Custom Exception enhances your code\u2019s reliability and maintainability, ensuring that errors are caught, properly understood, and resolved.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/working-with-custom-exception-in-c\/\" \/>\n<meta property=\"og:site_name\" content=\"Naveed Ul-Haq&#039;s blog\" \/>\n<meta property=\"article:published_time\" content=\"2023-09-07T09:00:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.naveedulhaq.com\/wp-content\/uploads\/2021\/11\/240px-.NET_Logo.svg_.png\" \/>\n\t<meta property=\"og:image:width\" content=\"240\" \/>\n\t<meta property=\"og:image:height\" content=\"240\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Abdul Mannan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Abdul Mannan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/working-with-custom-exception-in-c\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/working-with-custom-exception-in-c\\\/\"},\"author\":{\"name\":\"Abdul Mannan\",\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/#\\\/schema\\\/person\\\/8babf3cd198e47e5c727f67880ea7977\"},\"headline\":\"Working With Custom Exception in C#\",\"datePublished\":\"2023-09-07T09:00:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/working-with-custom-exception-in-c\\\/\"},\"wordCount\":537,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/#\\\/schema\\\/person\\\/dd6db5980b965fcae41e096d357c65c9\"},\"image\":{\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/working-with-custom-exception-in-c\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.naveedulhaq.com\\\/wp-content\\\/uploads\\\/2021\\\/11\\\/240px-.NET_Logo.svg_.png\",\"keywords\":[\".net core\",\".net framework\",\"asp.net\",\"c#\",\"developer\",\"development\",\"visual-studio\"],\"articleSection\":[\".NET\"],\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/working-with-custom-exception-in-c\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/working-with-custom-exception-in-c\\\/\",\"url\":\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/working-with-custom-exception-in-c\\\/\",\"name\":\"Working With Custom Exception in C# - Naveed Ul-Haq&#039;s blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/working-with-custom-exception-in-c\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/working-with-custom-exception-in-c\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.naveedulhaq.com\\\/wp-content\\\/uploads\\\/2021\\\/11\\\/240px-.NET_Logo.svg_.png\",\"datePublished\":\"2023-09-07T09:00:00+00:00\",\"description\":\"C# Custom Exception enhances your code\u2019s reliability and maintainability, ensuring that errors are caught, properly understood, and resolved.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/working-with-custom-exception-in-c\\\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/working-with-custom-exception-in-c\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/working-with-custom-exception-in-c\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.naveedulhaq.com\\\/wp-content\\\/uploads\\\/2021\\\/11\\\/240px-.NET_Logo.svg_.png\",\"contentUrl\":\"https:\\\/\\\/www.naveedulhaq.com\\\/wp-content\\\/uploads\\\/2021\\\/11\\\/240px-.NET_Logo.svg_.png\",\"width\":240,\"height\":240,\"caption\":\".net\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/index.php\\\/dot-net-core\\\/working-with-custom-exception-in-c\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.naveedulhaq.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Working With Custom Exception in C#\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/#website\",\"url\":\"https:\\\/\\\/www.naveedulhaq.com\\\/\",\"name\":\"Naveed Ul-Haq's blog\",\"description\":\"AI, Optimizely, Azure &amp; more\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/#\\\/schema\\\/person\\\/dd6db5980b965fcae41e096d357c65c9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.naveedulhaq.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/#\\\/schema\\\/person\\\/dd6db5980b965fcae41e096d357c65c9\",\"name\":\"Naveed Ul-Haq\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/362536aba6cc66917d7558cacd015a81c7cdf1a69b9a28c994764847c487b692?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/362536aba6cc66917d7558cacd015a81c7cdf1a69b9a28c994764847c487b692?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/362536aba6cc66917d7558cacd015a81c7cdf1a69b9a28c994764847c487b692?s=96&d=mm&r=g\",\"caption\":\"Naveed Ul-Haq\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/362536aba6cc66917d7558cacd015a81c7cdf1a69b9a28c994764847c487b692?s=96&d=mm&r=g\"},\"description\":\"I lead engineering delivery teams for digital commerce and digital experience platforms, combining hands-on architecture experience with strong delivery governance. Over 20+ years, I\u2019ve built and led cross\u2011functional teams (engineering, BA, QA) delivering modern cloud solutions on Azure, microservices, APIs and eCommerce\\\/CMS platforms. My recent focus includes AI-enabled commerce automation: product ingestion and enrichment workflows, content optimisation for SEO and shopping feeds, and agentic tooling to improve marketing and accessibility workflows. I\u2019m passionate about building high-performing teams, establishing quality\\\/release standards, and delivering measurable outcomes across performance, reliability, and speed of change.\",\"sameAs\":[\"https:\\\/\\\/www.naveedulhaq.com\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/naveedulhaq\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.naveedulhaq.com\\\/#\\\/schema\\\/person\\\/8babf3cd198e47e5c727f67880ea7977\",\"name\":\"Abdul Mannan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7021bf97f2da3c29882f0e194e341d6abcc2b18abbbbf1e8ea688017b2323d21?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7021bf97f2da3c29882f0e194e341d6abcc2b18abbbbf1e8ea688017b2323d21?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/7021bf97f2da3c29882f0e194e341d6abcc2b18abbbbf1e8ea688017b2323d21?s=96&d=mm&r=g\",\"caption\":\"Abdul Mannan\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Working With Custom Exception in C# - Naveed Ul-Haq&#039;s blog","description":"C# Custom Exception enhances your code\u2019s reliability and maintainability, ensuring that errors are caught, properly understood, and resolved.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/working-with-custom-exception-in-c\/","og_locale":"en_GB","og_type":"article","og_title":"Working With Custom Exception in C# - Naveed Ul-Haq&#039;s blog","og_description":"C# Custom Exception enhances your code\u2019s reliability and maintainability, ensuring that errors are caught, properly understood, and resolved.","og_url":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/working-with-custom-exception-in-c\/","og_site_name":"Naveed Ul-Haq&#039;s blog","article_published_time":"2023-09-07T09:00:00+00:00","og_image":[{"width":240,"height":240,"url":"https:\/\/www.naveedulhaq.com\/wp-content\/uploads\/2021\/11\/240px-.NET_Logo.svg_.png","type":"image\/png"}],"author":"Abdul Mannan","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Abdul Mannan","Estimated reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/working-with-custom-exception-in-c\/#article","isPartOf":{"@id":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/working-with-custom-exception-in-c\/"},"author":{"name":"Abdul Mannan","@id":"https:\/\/www.naveedulhaq.com\/#\/schema\/person\/8babf3cd198e47e5c727f67880ea7977"},"headline":"Working With Custom Exception in C#","datePublished":"2023-09-07T09:00:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/working-with-custom-exception-in-c\/"},"wordCount":537,"commentCount":0,"publisher":{"@id":"https:\/\/www.naveedulhaq.com\/#\/schema\/person\/dd6db5980b965fcae41e096d357c65c9"},"image":{"@id":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/working-with-custom-exception-in-c\/#primaryimage"},"thumbnailUrl":"https:\/\/www.naveedulhaq.com\/wp-content\/uploads\/2021\/11\/240px-.NET_Logo.svg_.png","keywords":[".net core",".net framework","asp.net","c#","developer","development","visual-studio"],"articleSection":[".NET"],"inLanguage":"en-GB","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/working-with-custom-exception-in-c\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/working-with-custom-exception-in-c\/","url":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/working-with-custom-exception-in-c\/","name":"Working With Custom Exception in C# - Naveed Ul-Haq&#039;s blog","isPartOf":{"@id":"https:\/\/www.naveedulhaq.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/working-with-custom-exception-in-c\/#primaryimage"},"image":{"@id":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/working-with-custom-exception-in-c\/#primaryimage"},"thumbnailUrl":"https:\/\/www.naveedulhaq.com\/wp-content\/uploads\/2021\/11\/240px-.NET_Logo.svg_.png","datePublished":"2023-09-07T09:00:00+00:00","description":"C# Custom Exception enhances your code\u2019s reliability and maintainability, ensuring that errors are caught, properly understood, and resolved.","breadcrumb":{"@id":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/working-with-custom-exception-in-c\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/working-with-custom-exception-in-c\/"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/working-with-custom-exception-in-c\/#primaryimage","url":"https:\/\/www.naveedulhaq.com\/wp-content\/uploads\/2021\/11\/240px-.NET_Logo.svg_.png","contentUrl":"https:\/\/www.naveedulhaq.com\/wp-content\/uploads\/2021\/11\/240px-.NET_Logo.svg_.png","width":240,"height":240,"caption":".net"},{"@type":"BreadcrumbList","@id":"https:\/\/www.naveedulhaq.com\/index.php\/dot-net-core\/working-with-custom-exception-in-c\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.naveedulhaq.com\/"},{"@type":"ListItem","position":2,"name":"Working With Custom Exception in C#"}]},{"@type":"WebSite","@id":"https:\/\/www.naveedulhaq.com\/#website","url":"https:\/\/www.naveedulhaq.com\/","name":"Naveed Ul-Haq's blog","description":"AI, Optimizely, Azure &amp; more","publisher":{"@id":"https:\/\/www.naveedulhaq.com\/#\/schema\/person\/dd6db5980b965fcae41e096d357c65c9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.naveedulhaq.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":["Person","Organization"],"@id":"https:\/\/www.naveedulhaq.com\/#\/schema\/person\/dd6db5980b965fcae41e096d357c65c9","name":"Naveed Ul-Haq","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/secure.gravatar.com\/avatar\/362536aba6cc66917d7558cacd015a81c7cdf1a69b9a28c994764847c487b692?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/362536aba6cc66917d7558cacd015a81c7cdf1a69b9a28c994764847c487b692?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/362536aba6cc66917d7558cacd015a81c7cdf1a69b9a28c994764847c487b692?s=96&d=mm&r=g","caption":"Naveed Ul-Haq"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/362536aba6cc66917d7558cacd015a81c7cdf1a69b9a28c994764847c487b692?s=96&d=mm&r=g"},"description":"I lead engineering delivery teams for digital commerce and digital experience platforms, combining hands-on architecture experience with strong delivery governance. Over 20+ years, I\u2019ve built and led cross\u2011functional teams (engineering, BA, QA) delivering modern cloud solutions on Azure, microservices, APIs and eCommerce\/CMS platforms. My recent focus includes AI-enabled commerce automation: product ingestion and enrichment workflows, content optimisation for SEO and shopping feeds, and agentic tooling to improve marketing and accessibility workflows. I\u2019m passionate about building high-performing teams, establishing quality\/release standards, and delivering measurable outcomes across performance, reliability, and speed of change.","sameAs":["https:\/\/www.naveedulhaq.com","https:\/\/www.linkedin.com\/in\/naveedulhaq\/"]},{"@type":"Person","@id":"https:\/\/www.naveedulhaq.com\/#\/schema\/person\/8babf3cd198e47e5c727f67880ea7977","name":"Abdul Mannan","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/secure.gravatar.com\/avatar\/7021bf97f2da3c29882f0e194e341d6abcc2b18abbbbf1e8ea688017b2323d21?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/7021bf97f2da3c29882f0e194e341d6abcc2b18abbbbf1e8ea688017b2323d21?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7021bf97f2da3c29882f0e194e341d6abcc2b18abbbbf1e8ea688017b2323d21?s=96&d=mm&r=g","caption":"Abdul Mannan"}}]}},"_links":{"self":[{"href":"https:\/\/www.naveedulhaq.com\/index.php\/wp-json\/wp\/v2\/posts\/1221","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.naveedulhaq.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.naveedulhaq.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.naveedulhaq.com\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.naveedulhaq.com\/index.php\/wp-json\/wp\/v2\/comments?post=1221"}],"version-history":[{"count":0,"href":"https:\/\/www.naveedulhaq.com\/index.php\/wp-json\/wp\/v2\/posts\/1221\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.naveedulhaq.com\/index.php\/wp-json\/wp\/v2\/media\/641"}],"wp:attachment":[{"href":"https:\/\/www.naveedulhaq.com\/index.php\/wp-json\/wp\/v2\/media?parent=1221"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.naveedulhaq.com\/index.php\/wp-json\/wp\/v2\/categories?post=1221"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.naveedulhaq.com\/index.php\/wp-json\/wp\/v2\/tags?post=1221"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}