I am trying to understand why the following is happening:
<script runat="server">
try{
Platform.Response.Redirect('http://www.google.com');
} catch(e) {
Platform.Response.Redirect('http://www.yahoo.com');
}
</script>
This code triggers the catch redirect. Why does it trigger the redirect of the catch block instead of the redirect in the try block. If I redirect from the catch block to a handler page and pass "e" I can see the following error:
{"message":"Error in the application.","description":"ExactTarget.OMM.AMPScriptRedirectException: Error in the application. - from Jint\r\n\r\n"}
If I remove or comment out the catch redirect, the redirect to google.com works fine. If I change the try block to anything but a redirect, it also works as expected. It seems only happen when there is a redirect in the try and catch block.
The above is the entire code.
Any ideas anyone?
Edit: There is another post regarding the same issue from earlier this year but with no response: https://stackoverflow.com/questions/60343379/ssjs-platform-response-redirect-throws-error-in-try-catch-statement