Developer forum

Forum » Development » ThreadAbortException Klarna V3

ThreadAbortException Klarna V3

Martin Moen

Quick question.
What is the reasoning behind this code? Are thread abort exceptions common?
And what exactly does the string.Empty do for the calling code?

UPDATE: Can see that it is present in most of the standard chekout handlers. Not just Klarna.


Morten Bengtson Dynamicweb Employee
Morten Bengtson
This post has been marked as an answer

A ThreadAbortException is thrown if there is any code which calls Response.End or Response.Redirect - maybe in a custom template.
This type of exception is different from other types of exceptions, because it is always rethrown by ASP.NET.
Instead of returning string.Empty we could also just rethrow the exception - but it makes no difference - the exception is rethrown anyway.
Redirects are very common, so the code here has been added to prevent that redirects are logged as errors.

More details here:


Votes for this answer: 1


You must be logged in to post in the forum