Created
April 5, 2020 14:07
-
-
Save omrilotan/6d649882ae455a7d2a59fd90d0e37389 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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