fixes bug 870045 - Carry error codes from the middleware into the public web API, r=rhelmer