Currently an ajax requests detects if the result is an error or not by searching for a magic comment which is next to the doctype. This is hacky, flakey, and has already proved to be problematic to work with.
Instead just set in the header that it's an error stack trace, and have the JS check for this on the result.
This should also make the on ready state change function less likely to break (as I suspect it's not perfect).
Currently an ajax requests detects if the result is an error or not by searching for a magic comment which is next to the doctype. This is hacky, flakey, and has already proved to be problematic to work with.
Instead just set in the header that it's an error stack trace, and have the JS check for this on the result.
This should also make the on ready state change function less likely to break (as I suspect it's not perfect).