<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Error-Handling on Java &amp; Software Architecture Knowledge Hub</title><link>https://samirsahoo.github.io/design-patterns-hub/tags/error-handling/</link><description>Recent content in Error-Handling on Java &amp; Software Architecture Knowledge Hub</description><generator>Hugo</generator><language>en-US</language><copyright>© 2026 Samir Kumar Sahoo (https://github.com/samirsahoo). All rights reserved.</copyright><atom:link href="https://samirsahoo.github.io/design-patterns-hub/tags/error-handling/index.xml" rel="self" type="application/rss+xml"/><item><title>RESTful API Design and Global Exception Handling</title><link>https://samirsahoo.github.io/design-patterns-hub/spring/web/rest-api-design-and-error-handling/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/spring/web/rest-api-design-and-error-handling/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A &lt;strong&gt;RESTful API&lt;/strong&gt; exposes &lt;strong&gt;resources&lt;/strong&gt; (orders, customers) at stable URIs and uses &lt;strong&gt;HTTP methods and status codes&lt;/strong&gt; with their standard meanings. &lt;strong&gt;Global exception handling&lt;/strong&gt; turns every error into a &lt;strong&gt;consistent, machine-readable response&lt;/strong&gt;, in Spring using &lt;code&gt;@RestControllerAdvice&lt;/code&gt; and &lt;strong&gt;RFC 9457 Problem Details&lt;/strong&gt;.&lt;/p&gt;</description></item><item><title>Exception Handling and Try-With-Resources</title><link>https://samirsahoo.github.io/design-patterns-hub/java/fundamentals/exceptions-and-try-with-resources/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://samirsahoo.github.io/design-patterns-hub/java/fundamentals/exceptions-and-try-with-resources/</guid><description>&lt;h2 id="simple-definition"&gt;Simple definition&lt;a class="heading-anchor" href="#simple-definition" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;An &lt;strong&gt;exception&lt;/strong&gt; is an object that signals that something went wrong and transfers control to the nearest matching &lt;code&gt;catch&lt;/code&gt;. &lt;strong&gt;Try-with-resources&lt;/strong&gt; automatically closes resources such as files, connections and streams, even when exceptions occur.&lt;/p&gt;&#10;&lt;h2 id="the-problem"&gt;The problem&lt;a class="heading-anchor" href="#the-problem" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Error codes are easy to ignore, and manual cleanup in &lt;code&gt;finally&lt;/code&gt; blocks is verbose and buggy: a second exception during cleanup hides the first. Badly designed exceptions leak implementation details, lose root causes or force callers into empty &lt;code&gt;catch&lt;/code&gt; blocks.&lt;/p&gt;</description></item></channel></rss>