Skip to content
This repository has been archived by the owner on May 25, 2024. It is now read-only.

fix: provide explicit error message for invalid token #25

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/components/vue/update-explorer/Explorer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const clearUpdates = () => {
// Listening
const token = ref("");
const username = ref("");

watch(token, (value) => {
localStorage.setItem("token", JSON.stringify(value));
});
Expand Down Expand Up @@ -156,10 +157,14 @@ onMounted(async () => {
v-if="error"
class="fixed inset-0 z-50 flex h-screen w-screen items-center justify-center overflow-y-auto bg-gray-600 bg-opacity-50"
>
<div class="w-96 rounded-md border-l-8 border-l-red-500 bg-altbackground p-5 shadow-lg">
<div class="max-w-min rounded-md border-l-8 border-l-red-500 bg-altbackground p-5 shadow-lg">
<span class="text-lg font-bold">An error has occured</span>
<p class="text-sm">There was an unexpected error. Check the details below:</p>
<pre class="mt-3 bg-background">{{ JSON.stringify(error, null, 2) }}</pre>
<pre class="mt-3 break-all bg-background" v-if="error.stack?.includes('getMe')">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too broad

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Broad as in?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

includes getMe

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know
I mentioned that it's hacky because as of now there's no way to detect of the error is from getMe method, blso either we use a .catch with the getMe method and catch the errors of that method seperately or do some hacks.

Invalid Bot token has been provided or a network problem has occured
</pre
>
<pre class="mt-3 bg-background" v-else>{{ JSON.stringify(error, null, 2) }}</pre>
<div class="flex w-full flex-row-reverse items-end">
<button
class="relative right-1 mt-4 rounded-md border bg-opacity-50 px-2 py-1 align-middle"
Expand Down