Skip to content
github-actions[bot] edited this page May 13, 2026 · 6 revisions

ripthrow Documentation

Quick Navigation

Why use Result instead of Throw?

Exceptions are effectively GOTO statements that can jump over many layers of your application. This makes reasoning about state difficult.

By using Result, failures become part of your function signatures:

import { Ok, Err, type Result } from "ripthrow";

function divide(a: number, b: number): Result<number, string> {
  if (b === 0) return Err("Division by zero");
  return Ok(a / b);
}

Now, the caller must handle the error or explicitly propagate it, leading to fewer runtime crashes.

Clone this wiki locally