<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Error Handling on Sanketh's Blog</title><link>https://sankethbk.github.io/blog/tags/error-handling/</link><description>Recent content in Error Handling on Sanketh's Blog</description><generator>Hugo -- 0.160.1</generator><language>en-us</language><lastBuildDate>Sun, 29 Mar 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://sankethbk.github.io/blog/tags/error-handling/index.xml" rel="self" type="application/rss+xml"/><item><title>Rust Notes — Module 6</title><link>https://sankethbk.github.io/blog/posts/rust/2026-03-29-rust-module-6-error-handling/</link><pubDate>Sun, 29 Mar 2026 00:00:00 +0000</pubDate><guid>https://sankethbk.github.io/blog/posts/rust/2026-03-29-rust-module-6-error-handling/</guid><description>&lt;h1 id="rust-notes--module-6-error-handling"&gt;Rust Notes — Module 6: Error Handling&lt;/h1&gt;
&lt;hr&gt;
&lt;h2 id="1-the-philosophy"&gt;1. The Philosophy&lt;/h2&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Language&lt;/th&gt;
&lt;th&gt;Error Mechanism&lt;/th&gt;
&lt;th&gt;Problem&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;C&lt;/td&gt;
&lt;td&gt;Return codes (&lt;code&gt;-1&lt;/code&gt;, &lt;code&gt;NULL&lt;/code&gt;, &lt;code&gt;errno&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;Easy to ignore, no enforcement&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Go&lt;/td&gt;
&lt;td&gt;&lt;code&gt;(value, error)&lt;/code&gt; tuples&lt;/td&gt;
&lt;td&gt;Better, but still ignorable&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Rust&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Result&amp;lt;T, E&amp;gt;&lt;/code&gt; in the type system&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Impossible to ignore — compiler enforced&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;If a function can fail, its return type says so. You cannot use the success value without handling the error case first. No hidden exceptions, no surprise crashes from ignored error codes.&lt;/p&gt;</description></item></channel></rss>