`await` unwraps a promise; a rejection becomes a thrown error you catch with `try/catch`. An async function always returns a promise.
try {
const r = await tx.wait();
} catch (e) {
console.error(e.shortMessage ?? e.message);
} finally {
setPending(false);
}Never leave a floating promise: unhandled rejections crash Node and are silently lost in browsers.