Commit 34531f52 by G

more logs and add a custom error name for unknown case

parent a821cee3
......@@ -27,7 +27,7 @@ export interface IorangeResponse {
const basictoken = base64.encode("admin:admin");
type OrangeStatus = "INITIATED" | "SUCCESS" | "FAILED";
export type OrangeStatus = "INITIATED" | "SUCCESS" | "FAILED";
export interface IorangePaymentStatus {
status: OrangeStatus;
code: number;
......@@ -95,12 +95,15 @@ export const getTransactionStatus = async (orderId: string) => {
default: {
log.warn("An unknown error occured, throwing error for mutation to catch");
const error = new Error("Payment failed");
error.name = "UNKNOWN_PAYMENT_ERROR";
error.name = "ORANGE_UNKNOWN_PAYMENT_ERROR";
throw error;
}
}
} catch (error) {
log.error("getTransactionStatus |", error);
log.error(
"getTransactionStatus | An unexpected error occured |",
JSON.stringify(error, null, 2),
);
throw error;
}
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment