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.

Devidas
3,3731 gold badge30 silver badges68 bronze badges
asked Sep 3, 2021 at 10:22
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
}
answered Sep 5, 2021 at 9:42

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.