changed handleErrorResponse function name to errorFromResponse