(error)
| 219 | } |
| 220 | |
| 221 | async function handleAutoRunLoopUnhandledError(error) { |
| 222 | const currentRuntime = runtime.get(); |
| 223 | console.error('Auto run loop crashed:', error); |
| 224 | if (!isStopError(error)) { |
| 225 | await addLog(`自动运行异常终止:${getErrorMessage(error) || '未知错误'}`, 'error'); |
| 226 | } |
| 227 | |
| 228 | runtime.set({ autoRunActive: false }); |
| 229 | await broadcastAutoRunStatus('stopped', { |
| 230 | currentRun: currentRuntime.autoRunCurrentRun, |
| 231 | totalRuns: currentRuntime.autoRunTotalRuns, |
| 232 | attemptRun: currentRuntime.autoRunAttemptRun, |
| 233 | }, { |
| 234 | autoRunTimerPlan: null, |
| 235 | scheduledAutoRunPlan: null, |
| 236 | }); |
| 237 | clearStopRequest(); |
| 238 | } |
| 239 | |
| 240 | function startAutoRunLoop(totalRuns, options = {}) { |
| 241 | autoRunLoop(totalRuns, options).catch((error) => { |
no test coverage detected