Should async/await functions be added with try catch?
There is no need to interrupt when an exception occurs at await. You can write it like this. You need to do a non-null check and the console will not report an error message.
let userInfo = await getUserInfo().catch(e => console.warn(e)) if (!userInfo) return
If you need to interrupt when an exception occurs at await and care about console errors, you can write
try { let userInfo = await getUserInfo() let pageInfo = await getPageInfo(userInfo?.userId) } catch(e) { console.warn(e) }
If you need to interrupt when an exception occurs at await, but don't care about console errors, you can write it like this
let userInfo = await getUserInfo().catch(e => { console.warn(e) return Promise.reject(e) }) let pageInfo = await getPageInfo(userInfo?.userId)