Files
xhs-examples/xhs-mini-demos/component-case/error-catch/error-catch.js
2025-09-14 00:21:54 +08:00

23 lines
407 B
JavaScript

Page({
data: {
},
handlePromise(){
return new Promise((_, rej) => {
rej(new Error('promise错误'));
});
},
handleTimer(){
setTimeout(() => {
throw new Error('setTimeout错误');
}, 1000);
},
handleStringError(){
return new Promise((_, rej) => {
rej('promise string错误');
});
},
handleSyncError() {
throw new Error('同步错误');
}
});