Skip to content

Instantly share code, notes, and snippets.

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

Sibiraj PR sibizulu

🏠
Working from home
View GitHub Profile

Solution to a better async/await error handling

const requestHandle = (promise) => {
  return promise
    .then(data => ([data, undefined]))
    .catch(error => Promise.resolve([undefined, error]));
}

Example