0

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.

1
  • if you can add code then its better to understand Commented Sep 5, 2021 at 9:37

1 Answer 1

0

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

}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.