mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-18 11:23:26 +08:00
fix(weixin): classify activation failures
This commit is contained in:
parent
832bd539a2
commit
77dea74326
7 changed files with 431 additions and 134 deletions
|
|
@ -25,6 +25,13 @@ function retryableStartError(error) {
|
|||
&& (error.status === 408 || error.status === 425 || error.status === 429 || error.status >= 500);
|
||||
}
|
||||
|
||||
function runtimeStartError(code, cause) {
|
||||
const error = new Error(`Weixin runtime failed during ${code}`, { cause });
|
||||
error.name = 'WeixinRuntimeStartError';
|
||||
error.code = code;
|
||||
return error;
|
||||
}
|
||||
|
||||
function delay(ms, signal) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (signal?.aborted) {
|
||||
|
|
@ -117,7 +124,11 @@ export class WeixinRuntime {
|
|||
this.#status.weixinConnectionState = 'connecting';
|
||||
this.#status.lastError = null;
|
||||
try {
|
||||
await this.#harness.ensureRunning();
|
||||
try {
|
||||
await this.#harness.ensureRunning();
|
||||
} catch (error) {
|
||||
throw runtimeStartError('harness-unreachable', error);
|
||||
}
|
||||
this.#status.harnessReachable = true;
|
||||
await this.#notifyStart();
|
||||
this.#abortController = new AbortController();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue