MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / handleError

Function handleError

src/lib/ajax.js:133–156  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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 /**

Callers 1

onreadystatechangeFunction · 0.70

Calls 2

definePropertyMethod · 0.80
onerrorFunction · 0.70

Tested by

no test coverage detected