48bad28a96
移动剪贴板触觉网络记录原生异常日志 相关测试覆盖稳定错误和日志边界 配置门禁和文档同步基础能力观测约束
22 lines
668 B
TypeScript
22 lines
668 B
TypeScript
import { getMobileNetworkStatus } from '../shell/network';
|
|
import { type HostBridgeRequest } from '../../../../packages/shared/src/contracts/hostBridge';
|
|
import { failure, ok } from './protocol';
|
|
|
|
function logMobileNetworkFailure(label: string, error: unknown) {
|
|
console.warn(`mobile network failed for ${label}`, error);
|
|
}
|
|
|
|
export async function getMobileHostBridgeNetworkStatus(
|
|
request: HostBridgeRequest,
|
|
) {
|
|
try {
|
|
return ok(request, await getMobileNetworkStatus());
|
|
} catch (error) {
|
|
logMobileNetworkFailure('status.query', error);
|
|
return failure(request, {
|
|
code: 'host_error',
|
|
message: 'network status unavailable',
|
|
});
|
|
}
|
|
}
|