Created
July 22, 2021 04:33
-
-
Save ram4git/efd9c381e4739e35dc3ef01af3f42f0d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
export const reportException = async (exception, reportToAppCenter = true) => { | |
const {appVersion, label} = await codePush.getUpdateMetadata() || {}; | |
try { | |
if (reportToAppCenter) { | |
Analytics.trackEvent(`Exception Occured ===> ${exception}`); | |
} | |
} catch { | |
} | |
try { | |
const uri = | |
'https://hooks.slack.com/services/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'; | |
const body = { | |
channel: '#lunchwale-exceptions', | |
username: 'ExceptionBot', | |
text: `[${appVersion}/${label}] => ${eventMessage}`, | |
icon_emoji: ':confounded:', | |
}; | |
await handleApiCall(uri, 'POST', body); | |
} catch { | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
//TODO do a primary tutorial on async/await or Javascript Promises
// https://www.youtube.com/watch?v=Bv_5Zv5c-Ts
// event loop https://www.youtube.com/watch?v=cCOL7MC4Pl0