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:
MatheusRdk 2025-07-23 15:14:08 -03:00 committed by GitHub
parent eedaa9a2e2
commit c8261d9883
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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;
} }
} }
}; };