Fixes #628 - adds infinite loop detection to error handling route