Skip to content

Commit ac50ce3

Browse files
committed
fix(): throw unauthenticated error when fetch contracts failed
1 parent 22be1cb commit ac50ce3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/easyops-runtime/src/flowApi/FlowApi.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import type {
1111
} from "@next-core/types";
1212
import { hasOwnProperty } from "@next-core/utils/general";
1313
import { getContract } from "./CollectContracts.js";
14+
import { isUnauthenticatedError } from "@next-core/runtime";
1415

1516
export type MinimalContractRequest = Pick<ContractRequest, "type"> & {
1617
fields?: MinimalContractField[];
@@ -280,6 +281,10 @@ async function fetchFlowApiDefinitionFromRemote(
280281
});
281282
contractData = contractList![0];
282283
} catch (e) {
284+
if (isUnauthenticatedError(e)) {
285+
// If unauthenticated, throw the error to be handled by upper level
286+
throw e;
287+
}
283288
error = e;
284289
}
285290

0 commit comments

Comments
 (0)