()
| 131 | } |
| 132 | |
| 133 | function handleError() { |
| 134 | let res = xhr; |
| 135 | |
| 136 | if (responseType === "json") { |
| 137 | let json; |
| 138 | |
| 139 | try { |
| 140 | json = JSON.parse(xhr.responseText); |
| 141 | } catch (error) { |
| 142 | json = xhr.responseText; |
| 143 | } |
| 144 | |
| 145 | Object.defineProperty(xhr, "response", { |
| 146 | value: json, |
| 147 | }); |
| 148 | } |
| 149 | |
| 150 | if (typeof ajax.response === "function") { |
| 151 | res = ajax.response(xhr); |
| 152 | } |
| 153 | |
| 154 | onerror(res); |
| 155 | reject(res); |
| 156 | } |
| 157 | }); |
| 158 | |
| 159 | /** |
no test coverage detected