Skip to content

Instantly share code, notes, and snippets.

@bcomnes
Last active October 22, 2021 00:27
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
import { someAsyncTask } from 'a-library'
async function doSomething () {
try {
const results = await someAsyncTask();
const betterResults = results.map(stuff => { betterStuff: stuff });
return results;
} catch (error) {
if (error instanceof Error){
console.error(error.message)
}
else {
// what do I do with any/unknown? throw?
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment