Handle 200 status response and add default error handling (#5227)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
parent
eedaa9a2e2
commit
c8261d9883
@ -25,12 +25,16 @@ export default function (wadoRoot, getAuthrorizationHeader) {
|
|||||||
//Call a function when the state changes.
|
//Call a function when the state changes.
|
||||||
if (xhr.readyState == 4) {
|
if (xhr.readyState == 4) {
|
||||||
switch (xhr.status) {
|
switch (xhr.status) {
|
||||||
|
case 200:
|
||||||
case 204:
|
case 204:
|
||||||
resolve(xhr.responseText);
|
resolve(xhr.responseText);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 404:
|
case 404:
|
||||||
reject('Your dataSource does not support reject functionality');
|
reject('Your dataSource does not support reject functionality');
|
||||||
|
default:
|
||||||
|
reject(`Unexpected status code: ${xhr.status}`);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user