Skip to content

Instantly share code, notes, and snippets.

@omrilotan
Created April 5, 2020 14:07
Show Gist options
  • Save omrilotan/6d649882ae455a7d2a59fd90d0e37389 to your computer and use it in GitHub Desktop.
Save omrilotan/6d649882ae455a7d2a59fd90d0e37389 to your computer and use it in GitHub Desktop.
async function userRefreshInbox({ username }) {
try {
const response = await getNewInboxItems();
// Do the thing you are supposed to do
} catch (error) {
error.code = 'SOME_ELABORATE_FLOW';
error.details = {
username,
flow: 'User refresh inbox',
};
setTimeout(() => { throw error; }); // Delayed so there should be no runtime breakage
// Explain nicely to your user that an error has occurred
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment