revisi handle error
This commit is contained in:
@@ -20,8 +20,16 @@ export const getBranch = async () => {
|
||||
} catch (e) {
|
||||
if (axios.isAxiosError(e)) {
|
||||
logging.error(NAME_SPACE, e.response?.data.toString());
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.response?.data.toString(),
|
||||
};
|
||||
} else if (e instanceof Error) {
|
||||
logging.error(NAME_SPACE, e.message);
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message,
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -43,8 +51,16 @@ export const getMgmMcu = async () => {
|
||||
} catch (e) {
|
||||
if (axios.isAxiosError(e)) {
|
||||
logging.error(NAME_SPACE, e.response?.data.toString());
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.response?.data.toString(),
|
||||
};
|
||||
} else if (e instanceof Error) {
|
||||
logging.error(NAME_SPACE, e.message);
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message,
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -69,8 +85,16 @@ export const uploadMgmMcu = async (branch: any, data: any) => {
|
||||
} catch (e) {
|
||||
if (axios.isAxiosError(e)) {
|
||||
logging.error(NAME_SPACE, e.response?.data.toString());
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.response?.data.toString(),
|
||||
};
|
||||
} else if (e instanceof Error) {
|
||||
logging.error(NAME_SPACE, e.message);
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message,
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -92,8 +116,16 @@ export const getMgmHeader = async (mgmMcuID: string) => {
|
||||
} catch (e) {
|
||||
if (axios.isAxiosError(e)) {
|
||||
logging.error(NAME_SPACE, e.response?.data.toString());
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.response?.data.toString(),
|
||||
};
|
||||
} else if (e instanceof Error) {
|
||||
logging.error(NAME_SPACE, e.message);
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message,
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -116,8 +148,16 @@ export const getTop3Kelainan = async (mgmMcuID: string) => {
|
||||
} catch (e) {
|
||||
if (axios.isAxiosError(e)) {
|
||||
logging.error(NAME_SPACE, e.response?.data.toString());
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.response?.data.toString(),
|
||||
};
|
||||
} else if (e instanceof Error) {
|
||||
logging.error(NAME_SPACE, e.message);
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message,
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -139,8 +179,16 @@ export const getMcuorder = async (mgmMcuID: string) => {
|
||||
} catch (e) {
|
||||
if (axios.isAxiosError(e)) {
|
||||
logging.error(NAME_SPACE, e.response?.data.toString());
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.response?.data.toString(),
|
||||
};
|
||||
} else if (e instanceof Error) {
|
||||
logging.error(NAME_SPACE, e.message);
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message,
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -163,8 +211,16 @@ export const getAntropometri = async (mgmMcuID: string) => {
|
||||
} catch (e) {
|
||||
if (axios.isAxiosError(e)) {
|
||||
logging.error(NAME_SPACE, e.response?.data.toString());
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.response?.data.toString(),
|
||||
};
|
||||
} else if (e instanceof Error) {
|
||||
logging.error(NAME_SPACE, e.message);
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message,
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -187,8 +243,16 @@ export const getMcuSnapshotNote = async (mgmMcuID: string) => {
|
||||
} catch (e) {
|
||||
if (axios.isAxiosError(e)) {
|
||||
logging.error(NAME_SPACE, e.response?.data.toString());
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.response?.data.toString(),
|
||||
};
|
||||
} else if (e instanceof Error) {
|
||||
logging.error(NAME_SPACE, e.message);
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message,
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -210,8 +274,16 @@ export const getMgmMou = async () => {
|
||||
} catch (e) {
|
||||
if (axios.isAxiosError(e)) {
|
||||
logging.error(NAME_SPACE, e.response?.data.toString());
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.response?.data.toString(),
|
||||
};
|
||||
} else if (e instanceof Error) {
|
||||
logging.error(NAME_SPACE, e.message);
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message,
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -236,8 +308,16 @@ export const uploadMgmHeader = async (branch: any, data: any) => {
|
||||
} catch (e) {
|
||||
if (axios.isAxiosError(e)) {
|
||||
logging.error(NAME_SPACE, e.response?.data.toString());
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.response?.data.toString(),
|
||||
};
|
||||
} else if (e instanceof Error) {
|
||||
logging.error(NAME_SPACE, e.message);
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message,
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -260,8 +340,16 @@ export const getMgmDetail = async (mgmHeaderID: any) => {
|
||||
} catch (e) {
|
||||
if (axios.isAxiosError(e)) {
|
||||
logging.error(NAME_SPACE, e.response?.data.toString());
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.response?.data.toString(),
|
||||
};
|
||||
} else if (e instanceof Error) {
|
||||
logging.error(NAME_SPACE, e.message);
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message,
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -284,8 +372,16 @@ export const getMgmRiwayat = async (mgmHeaderID: any) => {
|
||||
} catch (e) {
|
||||
if (axios.isAxiosError(e)) {
|
||||
logging.error(NAME_SPACE, e.response?.data.toString());
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.response?.data.toString(),
|
||||
};
|
||||
} else if (e instanceof Error) {
|
||||
logging.error(NAME_SPACE, e.message);
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message,
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -336,8 +432,16 @@ export const uploadMgmRiwayat = async (branch: any, data: any) => {
|
||||
} catch (e) {
|
||||
if (axios.isAxiosError(e)) {
|
||||
logging.error(NAME_SPACE, e.response?.data.toString());
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.response?.data.toString(),
|
||||
};
|
||||
} else if (e instanceof Error) {
|
||||
logging.error(NAME_SPACE, e.message);
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message,
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -362,8 +466,16 @@ export const uploadMgmMou = async (branch: any, data: any) => {
|
||||
} catch (e) {
|
||||
if (axios.isAxiosError(e)) {
|
||||
logging.error(NAME_SPACE, e.response?.data.toString());
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.response?.data.toString(),
|
||||
};
|
||||
} else if (e instanceof Error) {
|
||||
logging.error(NAME_SPACE, e.message);
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message,
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -389,8 +501,16 @@ export const uploadTop3Kelainan = async (branch: any, data: any) => {
|
||||
} catch (e) {
|
||||
if (axios.isAxiosError(e)) {
|
||||
logging.error(NAME_SPACE, e.response?.data.toString());
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.response?.data.toString(),
|
||||
};
|
||||
} else if (e instanceof Error) {
|
||||
logging.error(NAME_SPACE, e.message);
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message,
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -416,8 +536,16 @@ export const uploadMcuOrder = async (branch: any, data: any) => {
|
||||
} catch (e) {
|
||||
if (axios.isAxiosError(e)) {
|
||||
logging.error(NAME_SPACE, e.response?.data.toString());
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.response?.data.toString(),
|
||||
};
|
||||
} else if (e instanceof Error) {
|
||||
logging.error(NAME_SPACE, e.message);
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message,
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -443,8 +571,16 @@ export const uploadAntropometri = async (branch: any, data: any) => {
|
||||
} catch (e) {
|
||||
if (axios.isAxiosError(e)) {
|
||||
logging.error(NAME_SPACE, e.response?.data.toString());
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.response?.data.toString(),
|
||||
};
|
||||
} else if (e instanceof Error) {
|
||||
logging.error(NAME_SPACE, e.message);
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message,
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -470,8 +606,16 @@ export const uploadMcuSnapshotNote = async (branch: any, data: any) => {
|
||||
} catch (e) {
|
||||
if (axios.isAxiosError(e)) {
|
||||
logging.error(NAME_SPACE, e.response?.data.toString());
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.response?.data.toString(),
|
||||
};
|
||||
} else if (e instanceof Error) {
|
||||
logging.error(NAME_SPACE, e.message);
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message,
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -499,8 +643,16 @@ export const uploadMgmCompany = async (branchCode: any, mgmMcuID: any) => {
|
||||
} catch (e) {
|
||||
if (axios.isAxiosError(e)) {
|
||||
logging.error(NAME_SPACE, e.response?.data.toString());
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.response?.data.toString(),
|
||||
};
|
||||
} else if (e instanceof Error) {
|
||||
logging.error(NAME_SPACE, e.message);
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message,
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user