Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const apiCall = async () => {
- throw new Error('Big Bug')
- }
- async function autofulfill() {
- console.log('Autofulfill...');
- try {
- return await apiCall() // we need to `await` here, otherwise the error will be caught at this level!
- } catch (err) {
- console.log('> autofulfill catch bug!')
- }
- }
- async function start() {
- try {
- console.log('Start');
- await autofulfill()
- console.log('The end');
- }
- catch (err) {
- console.log('Main catch, TOO BAD!')
- }
- }
- start()
Add Comment
Please, Sign In to add comment