Skip to content

Commit

Permalink
Give more specific error message in search detail
Browse files Browse the repository at this point in the history
  • Loading branch information
joschrew committed Aug 23, 2023
1 parent 388cae2 commit 96a559f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/pages/search-detail/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
class="alert alert-danger alert-dismissible fade show"
role="alert"
>
<strong>Error!</strong> An error has occurred. Please try again.
<strong>Error!</strong>
<span> An error has occurred</span>
<span v-if="error_msg">: {{ error_msg }} </span>
<button
type="button"
class="close"
data-dismiss="alert"
aria-label="Close"
@click="error = null; error_msg = null"
>
<span aria-hidden="true">&times;</span>
</button>
Expand Down Expand Up @@ -116,6 +119,7 @@ export default {
return {
versionInfo: {},
error: null,
error_msg: null,
loading: true,
response: null,
isExpanded: false,
Expand Down Expand Up @@ -192,6 +196,11 @@ export default {
this.response = response.data;
} catch (error) {
if (error && error.message && error.message.includes("404")) {
this.error_msg = "No search entry found for PID"
} else {
this.error_msg = "Unknown error fetching search entry for PID"
}
this.error = true;
} finally {
this.loading = false;
Expand All @@ -205,6 +214,7 @@ export default {
this.consumeDownloadStream(response);
})
.catch((error) => {
this.error_msg = "Unknown error when exporting archive"
this.error = true;
});
},
Expand Down

0 comments on commit 96a559f

Please sign in to comment.