Commit 1912d793 by G

updating the name property of known error for specific handling

parent eab0abf3
...@@ -64,7 +64,15 @@ export const getTransactionStatus = async (orderId: string) => { ...@@ -64,7 +64,15 @@ export const getTransactionStatus = async (orderId: string) => {
log.http("getTransactionStatus |", JSON.stringify(response, null, 2)); log.http("getTransactionStatus |", JSON.stringify(response, null, 2));
if (response.status === "INITIATED") { if (response.status === "INITIATED") {
log.warn("Payment is still in progress, throwing error for mutation to catch"); log.warn("Payment is still in progress, throwing error for mutation to catch");
throw new Error("Payment is still in progress"); const error = new Error("Payment is still in progress");
error.name = "PaymentInProgress";
throw error;
}
if (response.status === "FAILED") {
log.warn("Payment failed, throwing error for mutation to catch");
const error = new Error("Payment failed");
error.name = "PaymentFailed";
throw error;
} }
log.http("getTransactionStatus |", JSON.stringify(response, null, 2)); log.http("getTransactionStatus |", JSON.stringify(response, null, 2));
return response; return response;
......
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