Skip to content

Instantly share code, notes, and snippets.

View lll000111's full-sized avatar
🏠
Working from home

KittenWithHerbs lll000111

🏠
Working from home
View GitHub Profile
@lll000111
lll000111 / async-error-demo.js
Created July 23, 2017 11:00
ES 2015 async/await error handling demo (better error stacktraces)
'use strict';
// ==============================================================
// HELPERS
// ==============================================================
// Needed to create a _really_ asynchronous function. A fake asynchronous function (returning "Promise.reject()"
// right away, for example) actually creates a stacktrace.
const wait = delay => new Promise(resolve => setTimeout(() => resolve(), delay));