Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save shlomisas/374fded0110ff2ecbadecaa40cd2348b to your computer and use it in GitHub Desktop.
Save shlomisas/374fded0110ff2ecbadecaa40cd2348b to your computer and use it in GitHub Desktop.
js-browser-app-event-listener-error-handling
$('#someButton').click(async evt => {
try {
const userId = $(evt.target).attr('data-user-id');
const res = await axios.get(`/user/${userId}`);
// Assume that `render` function exists
render(res);
} catch (e) {
console.log(e);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment