I am using create post plugin. But the issue with this is, I want to redirect it to a custom URL if an error occurred in createPost() default to execute the function.
For example, if a customer with the same email id already exists then it goes in the catch of default createPost() execute function's catch. I want to redirect it to my custom page.
Please note, No code to add in try. So try-catch is not used.
Also tried with throw exception but I don't know how to direct with throw exception or with throw it is possible or not.
Thanks in advance.
-
if you can add code then its better to understandGohil Rajesh– Gohil Rajesh2021年09月05日 09:37:58 +00:00Commented Sep 5, 2021 at 9:37
1 Answer 1
You can add redirect code in Catch section instead of show/print error.
try{
//your logic / code
}catch{
if error then it comes in catch so,add your redirect code here
}