Tariq Salim
11 posts
Registered:
04 Jul 2022
Answered
20 Jan 2023
in reply to
Krishna Hari
Link to this post
Hello Krishna,
Please try the following, write a function to handle the error and redirect the page to an error page in the following way:
function handleError(errorMessage) {
if (errorMessage.includes("Does Not Exist")) {
window.location.replace("https://your-error-page.com");
}
}
try {
// your code to load the form with custom query string
} catch (error) {
handleError(error.message);
}
In this code, we first define a function handleError that takes in an error message as a parameter. The function checks if the error message contains the string "Does Not Exist". If it does, it uses the window.location.replace method to redirect the user to the error page.
Next, we wrap the code to load the form with custom query string in a try-catch block. If an error occurs, the catch block will catch it and pass the error message to the handleError function.
Let us know if this helps resolve your issue.
Best Regards,
Tariq
Last modified on 31 Jan 2023 21:01 by Tariq Salim