Skip to content

Latest commit

 

History

History
19 lines (12 loc) · 498 Bytes

readme.md

File metadata and controls

19 lines (12 loc) · 498 Bytes

TS Error handling, the go way

This is mostly a small convenience for myself. I wanted to see what it's like to publish an npm package, if you want to use it, write it yourself, it's probably gonna be better.

Code Example:

import { handleException } from 'ts-go-exceptions';

const theBigAsync = async () => {...};

const [result, error] = await handleException<ResultType, ErrorType>(theBigAsync());

if (error !== null) {
  // handle error
};

// You're free to use result!