<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Engineering on Prateek Sharma</title>
		<link>https://prateeksharma.me/categories/engineering/</link>
		<description>Recent content in Engineering on Prateek Sharma</description>
		<generator>Hugo</generator>
		<language>en-us</language>
		
		
		
		
			<lastBuildDate>Fri, 28 Aug 2026 00:00:00 +0000</lastBuildDate>
		
			<atom:link href="https://prateeksharma.me/categories/engineering/index.xml" rel="self" type="application/rss+xml" />
			<item>
				<title>Give callers two error types, one extending the other</title>
				<link>https://prateeksharma.me/opinions/two-exceptions-not-one/</link>
				<pubDate>Fri, 28 Aug 2026 00:00:00 +0000</pubDate>
				<guid>https://prateeksharma.me/opinions/two-exceptions-not-one/</guid>
				<description>&lt;p&gt;In the &lt;a href=&#34;https://prateeksharma.me/projects/wazirx-connector-java/&#34;&gt;WazirX Java connector&lt;/a&gt;&#xA; I split errors&#xA;into two:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;WazirxClientException&lt;/code&gt; — the caller made a mistake the caller can fix: a bad&#xA;&lt;code&gt;side&lt;/code&gt; value, a missing required field. Thrown before a request is even sent.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;WazirxApiException&lt;/code&gt; — something went wrong once the request left the process:&#xA;a network failure, a non-2xx response.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;code&gt;WazirxClientException extends WazirxApiException&lt;/code&gt;. That one line is the whole&#xA;design. A caller who only cares &amp;ldquo;did this work?&amp;rdquo; catches the parent. A caller who&#xA;wants to retry network failures but fail fast on their own bad input catches both&#xA;separately. Nobody is forced into a giant &lt;code&gt;catch (Exception e)&lt;/code&gt; that swallows&#xA;bugs, and nobody has to &lt;code&gt;try/catch&lt;/code&gt; five specific types at every call site.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Generic returns can be the right call for a library you maintain alone</title>
				<link>https://prateeksharma.me/opinions/generic-returns-for-a-solo-maintained-library/</link>
				<pubDate>Wed, 26 Aug 2026 00:00:00 +0000</pubDate>
				<guid>https://prateeksharma.me/opinions/generic-returns-for-a-solo-maintained-library/</guid>
				<description>&lt;p&gt;The standard advice for a client library is: give callers typed responses.&#xA;&lt;code&gt;client.Ticker(...) (*Ticker, error)&lt;/code&gt;, not &lt;code&gt;(any, error)&lt;/code&gt;. I went the other way&#xA;in my &lt;a href=&#34;https://prateeksharma.me/projects/wazirx-connector-go/&#34;&gt;WazirX Go connector&lt;/a&gt;&#xA; and I still think it&#xA;was right &lt;em&gt;for that library&lt;/em&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The upstream API&amp;rsquo;s response shapes move around — objects that become arrays,&#xA;fields that appear and vanish across endpoints. With ~25 endpoints and one&#xA;maintainer (me, in spare hours), typed structs would mean 25 things to keep in&#xA;sync with an API I don&amp;rsquo;t control and can&amp;rsquo;t see changes to until they ship. The&#xA;generic return pushed that cost to the call site, where the caller already knows&#xA;which two fields they want and can assert for them.&lt;/p&gt;</description>
			</item>
	</channel>
</rss>
