try-never-throw
v0.1.1
Published
TypeScript utility library for functional error handling with Result types
Readme
try-never-throw
Convert throwing functions into Result types. Zero dependencies, 4 functions, full TypeScript support.
Installation
npm install try-never-throw
pnpm add try-never-throw
yarn add try-never-throwUsage
import { tryit, tryitAsync, isSuccess, isError } from 'try-never-throw'
// Sync operations
const result = tryit(() => maybeThrowing())
if (isSuccess(result)) {
console.log(result.value)
}
// Async operations
const result = await tryitAsync(() => maybeThrowingAsync())
if (isError(result)) {
console.error(result.error)
}Alternatives
For advanced use cases:
