Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const res = await getApplicationCount().catch((e: { code: number }) => {
// NOT_FOUND is the initial normal state, so it is excluded from error handling.
if (e.code !== StatusCode.NOT_FOUND) {
throw e;
}
});
import { createHandler, createHandlerWithError } from "../create-handler";
export const getInsightApplicationCountHandler = createHandler<
GetInsightApplicationCountResponse
>("/GetInsightApplicationCount", () => {
const response = new GetInsightApplicationCountResponse();
response.setUpdatedAt(createRandTime().unix());
response.setCountsList(
dummyApplicationCounts.map(createInsightApplicationCountFromObject)
);
return response;
});
export const getInsightApplicationCountNotFound = createHandlerWithError(
"/GetInsightApplicationCount",
StatusCode.NOT_FOUND
);
export const insightHandlers = [
getInsightApplicationCountHandler,
createHandler("/GetInsightData", () => {
const response = new GetInsightDataResponse();
response.setUpdatedAt(1);
response.setMatrixList([]);
const dataPointsList = createDataPointsListFromObject(dummyDataPointsList);
const insightSampleStream = new InsightSampleStream();
insightSampleStream.setDataPointsList(dataPointsList);
response.setVectorList([]);
response.setDataPointsList(dataPointsList);
response.setType(InsightResultType.MATRIX);
return response;
}),