Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better console messages when API key is invalid #158

Open
hhkaos opened this issue Jan 18, 2023 · 10 comments
Open

Better console messages when API key is invalid #158

hhkaos opened this issue Jan 18, 2023 · 10 comments

Comments

@hhkaos
Copy link
Member

hhkaos commented Jan 18, 2023

Describe the problem

I just realized that when using an invalid API key the error message is not intuitive at all:
invalid-api-key-leaflet

Describe the proposed solution

I would prefer a console error by showing Invalid API key or access token or something like that.

Alternatives considered

No response

Additional Information

I noticed I'm not the first one struggling with this xD

@hhkaos hhkaos changed the title Better console messages when API key is wrong Better console messages when API key is invalid Jan 18, 2023
@gavinr
Copy link
Contributor

gavinr commented Mar 27, 2023

Thanks for the suggestion. Seems like a good idea to me.

@sdthaker

This comment was marked as off-topic.

@gavinr-maps

This comment was marked as off-topic.

@sdthaker
Copy link
Contributor

sdthaker commented Oct 6, 2023

Since I'm quite new to this repository, wanted to know what would be the best way to test the code changes made for this issue. Would that be to open the HTML files in the example directory (after running npm run build) and check to see if the API calls are managed properly in the console and whether the proper log is shown to the user? Thanks! @gavinr-maps

@sdthaker
Copy link
Contributor

sdthaker commented Oct 6, 2023

Also, the tests are failing for spec/VectorTileLayerSpec.js after making the changes in src/VectorTileLayer.js to throw an error when api key or token is not provided. However, the tests are passing for spec/VectorBasemapLayerSpec.js because each test case passes either an api key or token when testing different cases. Does that mean that test cases for spec/VectorTileLayerSpec.js need to be updated so now each test case passes an api key or token at the very least? Please let me know if this makes sense. Thanks! @gavinr-maps

@sdthaker sdthaker mentioned this issue Oct 6, 2023
@Kizito007
Copy link
Contributor

Kizito007 commented Oct 22, 2024

Hey everyone.

Has this issue been addressed because I had something similar and didn't know what the issue was until I checked my console.

image

Cc @gavinr-maps

@hhkaos
Copy link
Member Author

hhkaos commented Oct 22, 2024

I don't think so 😄

@Kizito007
Copy link
Contributor

What will be the best way to render it on the UI?

@hhkaos
Copy link
Member Author

hhkaos commented Oct 22, 2024

I would say a console.warn('Invalid API key or access token');, but I don't know if @gavinr-maps would agree 😄

@gavinr-maps
Copy link
Contributor

I would say a console.warn('Invalid API key or access token');, but I don't know if @gavinr-maps would agree 😄

That is ok with me. Thanks!

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

No branches or pull requests

6 participants