惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
V2EX
爱范儿
爱范儿
Martin Fowler
Martin Fowler
T
The Blog of Author Tim Ferriss
B
Blog RSS Feed
博客园 - 聂微东
G
GRAHAM CLULEY
Engineering at Meta
Engineering at Meta
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
WordPress大学
WordPress大学
Scott Helme
Scott Helme
AI
AI
S
Security Affairs
T
Threat Research - Cisco Blogs
M
MIT News - Artificial intelligence
T
Troy Hunt's Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
人人都是产品经理
人人都是产品经理
AWS News Blog
AWS News Blog
T
Threatpost
Cyberwarzone
Cyberwarzone
www.infosecurity-magazine.com
www.infosecurity-magazine.com
U
Unit 42
V
Vulnerabilities – Threatpost
J
Java Code Geeks
博客园 - Franky
月光博客
月光博客
Blog — PlanetScale
Blog — PlanetScale
NISL@THU
NISL@THU
D
Docker
小众软件
小众软件
N
News and Events Feed by Topic
Microsoft Security Blog
Microsoft Security Blog
Y
Y Combinator Blog
A
Arctic Wolf
D
DataBreaches.Net
云风的 BLOG
云风的 BLOG
Forbes - Security
Forbes - Security
量子位
PCI Perspectives
PCI Perspectives
美团技术团队
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
I
InfoQ
Security Archives - TechRepublic
Security Archives - TechRepublic
有赞技术团队
有赞技术团队
腾讯CDC
P
Proofpoint News Feed
S
Security @ Cisco Blogs
G
Google Developers Blog
C
Cisco Blogs

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
The Utter Failure of the JS Error (and why you should still use JS)
Michael Inte · 2026-04-28 · via DEV Community

The Sin of Simplicity

3.4 million years ago, apes began to demonstrate the ability to use tools.
Impressively, by 1995, those same apes could write dynamic web pages. Back
then, the majority of those apes were writing linear scripts with very few potential failure modes. They had yet to encounter the dense forest of AJAX, or the swamplands of the permissions API and its apex predator, getUserMedia. No, at this point in history, they were still enchanted by the dry savanna of client-side form validation.

Back then, the amount of ways a JavaScript application could fail was relatively small, and in the majority of failure cases, it didn't really matter how you responded (if at all).

Take the following, for example.

function validateForm() {
    // 1. Check if the name field is empty
    if (document.myForm.userName.value == "") {
        alert("Please enter your name.");
        document.myForm.userName.focus();
        return false;
    }

    // 2. Check if the age is a number
    var ageValue = document.myForm.userAge.value;
    if (isNaN(parseInt(ageValue))) {
        alert("Please enter a numeric age.");
        document.myForm.userAge.select();
        return false;
    }

    // If all checks pass
    alert("Form is valid! Submitting...");
    return true;
}

Enter fullscreen mode Exit fullscreen mode

This was just about the most complex JS code anyone had written at the time. In this function, the closest thing to failure is the violation of the form invariants.

Now, let's consider something you might write today.

async function getUserData() {
    const response = await fetch('/api/user/1'); 
    const data = await response.json(); 
    console.log(data);
}

Enter fullscreen mode Exit fullscreen mode

How many places can this fail? I'll save you the suspense. It's at least this many:

async function getUserData() {
    // failure modes: 400/500 errors; literally any network-related error
    const response = await fetch('/api/user/1'); 

    // failure mode: .json() throws if response is empty or invalid JSON
    const data = await response.json(); 
    console.log(data);
}

Enter fullscreen mode Exit fullscreen mode

So, how do you handle this? Maybe …

async function getUserData() {
    try {
        const response = await fetch('/api/user/1'); 
        const data = await response.json(); 
        console.log(data);
    } catch (error) {
        console.error('Error: ', error);
    }
}

Enter fullscreen mode Exit fullscreen mode

The problem? When something does go wrong, we have absolutely no idea what actually failed.

There's more than one way to handle this, but I'll pick this one for the sake of argument.

async function getUserData() {
    try {
        const response = await fetch('/api/user/1'); 
    } catch (error) {
        console.error('Fetch failed:', error);
        return
    }

    try {
        const data = await response.json(); 
    } catch (error) {
        console.error('Failed to parse response as JSON:', error);
        return
    }

    console.log(data);
}

Enter fullscreen mode Exit fullscreen mode

Now, look me in the eyes and tell me you'd actually write the last one at 4:55 PM on a Friday.

Therein lies the problem. You have to explicitly declare "I would like my consumer to function properly" at every potential failure point. When every single line of code is a potential failure point, try/catch, is just the wrong abstraction. That's opt-in predictability, where predictability can be defined as, at best, the absence of negligence.

That design philosophy made sense when the happy path was the only path you realistically needed to worry about. Now, though, we write actual libraries and applications with JavaScript.

As the language grew, its error handling didn't, and now exists purely as a vestige of humble beginnings.

Simplicity Built on Complexity Is Just Hidden Complexity

Imagine the flow of data through your (JS) program's call stack looks like this.

flow chart with boxes reperesenting function calls with arrows representing params and return values between them

Straightforward, right? No.

The above topology is incomplete. Here's what it actually looks like.

the same flow chart, but next to it is a similar one where arrows represent errors instead of returned values

Now, please reread the section title.

Simplicity Built on Complexity Is Just Hidden Complexity

I'll connect the dots for you in a second, but I'd assume many of you already know where I'm going with this.

The "hidden complexity" here is the fact that your program can actually fail. I don't know about the rest of the "ape with keyboard" population, but personally, I feel that Brendan Eich may not have had the utmost confidence in our collective intelligence when he made the decision to hide this from us.

As someone who writes a lot of library-level code, I'm the kind of person this burden ultimately falls on. That said, if you have ever written JavaScript/TypeScript that gets called by anything ever, then you are also that kind of person.

If you dare to call functions, then you are also affected. Often, you have no way of knowing whether the thing you are using is going to throw unless you read the source. If it's invisible to the type system, it's invisible to the consumer. I need not explain further why this is bad.

None of this is meant to surprise you or present itself as a novel idea. In fact, if I've done my job right, you've been thinking "yeah, I know" this whole time.

So, what now?

How to Fail Correctly

Rust is not perfect by any means, but I enjoy writing it far more than I enjoy writing TypeScript. A surprising amount of that fact can be attributed to its philosophy around what "errors as values" actually means.

Since you're already familiar with this form of diagram, here's the Rust version:

A similar diagram to above, but with only one column with return, param, and error arrows.

The keen-eyed among you will have noticed something shocking: the two columns have merged! Instead of insultingly obfuscating your program's error economy from you, Rust forces you to think about it.

If your eyes were made for the beautiful : of TypeScript, and not the -> of Rust, you have permission to close them, but be warned, this code will still be there when you open them.

fn get_user_data() -> Result<User, UserDataError> {
    let response = get("/api/user/1")?;
    let data = response.json()?;
    Ok(data)
}

Enter fullscreen mode Exit fullscreen mode

If you're unfamiliar with the pattern, a Result<T, E> is just a monoid in the category of endofunctors. You can think of it as a discriminated union that wraps some "good" value T in the event of a successful call, or some error E in the event of an error.

The ? operator is syntactic sugar that propagates errors up the call stack. If get() fails, the function returns early with the error. If response.json() fails, the function returns early with that error. The caller now has complete visibility into what failed without any try/catch boilerplate.

How do you consume this function? Rust has a number of idioms for dealing with this, some markedly more attractive than others. To showcase one that I'm particularly fond of that isn't the ? operator, I'll show you the following.

fn print_user_data() {
    let data = get_user_data()
        .unwrap_or_else(|| get_cached_user_data());

    println!("{:?}", data);
}

Enter fullscreen mode Exit fullscreen mode

unwrap_or_else is very powerful as used above. It allows the expression get_cached_user_data() to be lazily evaluated, meaning the cache is only invoked when it has to be.

This is to illustrate that Rust, in being very explicit in its error handling philosophy, allows you to easily define exactly how much you care about if, how, or in what context something fails, and how you'd like to deal with that failure.

For example, you have to explicitly tell the compiler that failure is not an issue:

// (Usually) won't compile.
fs::remove_file("/tmp/temp_cache");

// Failing to remove a temp file is probably fine,
// and this is how we tell the compiler (actually, the linter in this case).
let _ = fs::remove_file("/tmp/temp_cache");

// Note: Any binding called _ is not a binding at all, rather,
// a placeholder that tells Clippy, Rust's canonical linter, to ignore a value 
// (as is emulated in most of your ESLint configs, I'm sure).

Enter fullscreen mode Exit fullscreen mode

Whereas, in TypeScript you have to explicitly state that failure IS an issue.

That's a strange thing to have to say about failure.

neverthrow and the thiserror-shaped Hole

If you're really deep in the TypeScript rabbit hole, you know exactly what this section is about. The gorgeous, unapologetically Rust-like time sink that is neverthrow.

If you're unfamiliar, here's everything I knew when I wrote my first line of neverthrow-flavored TypeScript:

async function getUserData() {
    const response = await fetchFromAParallelUniverse('/api/user/1'); // returns a neverthrow Result<UserData, SomeErrorType>
    if (response.isErr()) { // This method is on all neverthrow Results
        console.error('Fetch failed:', response.error); // We can extract the inner error using the `error` member.
        return
    }

    // We can extract the inner value by using the `value` member.
    const data = await response.value.json(); 
    if (data.isErr()) {
        console.error('Failed to parse response as JSON:', error);
        return
    }

    // TypeScript knows that value is defined, but error is not at compile time.
    console.log(data.value);
    tryToConsume(data.error);
    //                 ^? undefined
}

Enter fullscreen mode Exit fullscreen mode

To be clear, neverthrow isn't the only solution to this problem, but I'd recommend it over something like Effect to most people grasping the pattern for the first time, since it doesn't require you to port your prefrontal cortex to Haskell.

The important thing to note here is that you don't get to use the inner value until you've acknowledged the failure case. This necessarily inverts the usual TypeScript paradigm:

… in TypeScript you have to explicitly state that failure IS an issue.

However, a question is yet unanswered here, and it actually exists in the Rust examples as well:

What type are the errors?

The usual TypeScript answer to this question is "I dunno, Error?", and this is actually the case more often than not even with neverthrow.

Within the Rust ecosystem, there are a few good answers. The application developer-sanctioned choice, is anyhow. It's effectively a set of tools for working with a single anyhow::Error type that can consume any error you can think of with minimal keystrokes.

If you ask a library developer, they'd tell you about thiserror, whose claim to fame is its ability to allow you to easily define custom error types, again, with minimal keystrokes.

In TypeScript, however, this is impossible, because thiserror's primary ergonomic benefit is driven entirely by Rust's powerful metaprogramming functionality.

This is the hole. You can get really close, but inverting paradigms is as hard as inverting (I really tried to find a good way to finish this sentence, so use your imagination). Metaprogramming simply does not exist in TypeScript, so if you want to use neverthrow as divinely ordained, you're gonna be writing some boilerplate.

And yet …

You Should Still Use JS

The point of this article is not to pit JS against Rust. That's a silly comparison. They solve fundamentally different problems for different people with different constraints.

Rather, my intention was to explore my personal biggest problem with JS, and be specific about what a good solution to that problem actually looks like.

Do I think we will ever see Rust-like error handling as a first-class citizen? For a multitude of reasons, almost certainly not (as much as I would like to be proven wrong).

JS is a microcosm of its own flaw. It's not conceptually attractive, nor philosophically correct, but it ships software.

Why?

Because the entire planet already depends on this nuclear pile of [object Object].

If you have a problem in TypeScript, there's a good solution written in TypeScript. If you have a problem in Rust, there's a solution written in Rust with zero documentation, and a solution written in C with Rust bindings with zero documentation.

The corpus of public TypeScript code is an order of magnitude larger than that of Rust. This poses more potential benefits than just the above, such as the fact that LLM inference over TypeScript code is categorically better than that over Rust code.

Hence, if you want to go home at 5:00 o'clock, and don't have a compelling reason to use something else, you should be writing JS/TS.

Yes, it has absolutely no business being as relied upon as it is.

Yes, its answer to error handling becomes a burden as soon as you try to step outside the boundaries of what it was originally designed for.

Yes, it (insert any of the million things wrong with JS).

Use it anyway.

The language doesn't deserve you, but here we are.