Created
August 26, 2020 10:04
-
-
Save rgabaydullov/3693e26c6cbe090a049a64595a88def3 to your computer and use it in GitHub Desktop.
Async code error handling example
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
| // ... | |
| const middlewareRequest = async (req) => { | |
| try { | |
| const { data } = await axios.get(req); | |
| return data; | |
| } catch (err) { | |
| throw new Error(err); | |
| } | |
| } | |
| // ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment