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

fix: provide explicit error message for invalid token #25

wants to merge 2 commits into from

Conversation

code-withAshish
Copy link
Contributor

Earlier the error message for invalid token was very general and stated HTTP error, this PR fixes this by checking the error stack if it contains the error from getMe method then concludes either of two errors have occured:-

  1. A network problem has occured.
  2. Invalid bot token has been provided.

It's somewhat hacky to say the least but i think it gets the work done.

fixes #10

<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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: bad error message when passing an invalid token
2 participants