mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 21:04:31 +00:00
refactor: harden msteams lifecycle and attachment flows
This commit is contained in:
17
extensions/msteams/src/revoked-context.ts
Normal file
17
extensions/msteams/src/revoked-context.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { isRevokedProxyError } from "./errors.js";
|
||||
|
||||
export async function withRevokedProxyFallback<T>(params: {
|
||||
run: () => Promise<T>;
|
||||
onRevoked: () => Promise<T>;
|
||||
onRevokedLog?: () => void;
|
||||
}): Promise<T> {
|
||||
try {
|
||||
return await params.run();
|
||||
} catch (err) {
|
||||
if (!isRevokedProxyError(err)) {
|
||||
throw err;
|
||||
}
|
||||
params.onRevokedLog?.();
|
||||
return await params.onRevoked();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user