Skip to content

Commit

Permalink
[Dataset Guardrails] More targeted error handling (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
jvigliotta authored Sep 2, 2023
1 parent d92fd69 commit 97bf4ed
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/customForms/UrlField/UrlField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,17 @@ export default {
}
try {
const response = await fetch(this.testUrl, {
method: 'HEAD'
});
const response = await fetch(this.testUrl);
if (response.ok) {
this.warn = false;
} else {
this.warn = true;
if (
response.status === 403
|| response.status === 404
|| response.status >= 500
) {
throw new Error(response.status);
}
this.warn = false;
} catch (error) {
this.warn = true;
console.warn(error.message);
Expand Down

0 comments on commit 97bf4ed

Please sign in to comment.