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

Issue #158 #202

Closed
wants to merge 2 commits into from
Closed

Issue #158 #202

wants to merge 2 commits into from

Conversation

sdthaker
Copy link
Contributor

@sdthaker sdthaker commented Oct 6, 2023

Changes Made:

  • Added error handling within src/VectorTileLayer.js when api key or token is not provided.
  • Updated all test cases within spec/VectorTileLayerSpec.js to pass api key or token so that test cases can pass, as discussed here.

Testing

  • Automated testing of the code changes using npm test, passed all tests,
    image
  • Manual testing of the HTML files within /examples by opening them onto the browser, to make sure the error is shown to the user on the console, as discussed here.

Issue

Additional Notes

Please let me know if there are any other changes that are to be made as part of the PR. I might've missed something considering I'm quite new to this repo and open-source development in general. Thanks!

@patrickarlt patrickarlt self-requested a review October 9, 2023 16:44
Copy link
Contributor

@patrickarlt patrickarlt left a comment

Choose a reason for hiding this comment

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

@sdthaker thanks for opening this up. Unfortunately the issue didn't have a lot of good information about the proper resolution of the issue. The main missing detail is that apiKey/token is an optional parameter and not all services will require it.

If you want to take a stab at this then the proper way to resolve this would be to check for an error message if a request with an apiKey/token fails and then we could prompt the user that their provided apiKey/token property might be invalid or missing.

@sdthaker
Copy link
Contributor Author

sdthaker commented Oct 9, 2023

So should I revert back the code that I changed for all the test cases in spec/VectorTileLayerSpec.js? Thanks

@patrickarlt
Copy link
Contributor

@sdthaker I would probably start by reverting all changes you have made so far (sorry) and adding a check on these lines https://github.com/Esri/esri-leaflet-vector/blob/master/src/VectorTileLayer.js#L62-L67 when there is an error loading the style add the error messages there. You'll need to test lots of different scenarios with an invalid token (just any random string) to make sure you catch all the different error messages since each of these scenarios will produce different error messages:

  • Loading from an item id
  • Loading from a service URL
  • Loading from a style obejct
  • Loading from an enumerated basemap with L.Esri.VectorBasemapLayer
  • Loading from an item id with L.Esri.VectorBasemapLayer

@sdthaker
Copy link
Contributor Author

sdthaker commented Oct 9, 2023

After adding a console.log for the error variable, above line 62, building the static HTML files and opening each of them on the browser, I always see the error being printed as either undefined or null on the browser console. Am I testing this right?

For some of the files, the error is not printed at all since I believe the execution of the script is halted somewhere before the code execution reaches L62-L67 since it shows some other error regarding this #102

@sdthaker
Copy link
Contributor Author

sdthaker commented Oct 9, 2023

I've added a console.log() to show the error to the user. I tested the first 3 bullet points, by manually editing examples/custom-vtl-dev.html script tag and it logged the error An error occurred: Invalid token. I was unsure about how to test the last 2 bullet points. Please let me know if the commit I made makes sense and if there is anything else to be added/removed as part of this PR.

I apologize, I'm quite new to this project so everything is haywire for me right now, still trying to make sense of what's the purpose of this project, what the classes in the src directory do, how everything is connected together etc, etc. Thanks! @patrickarlt

@sdthaker
Copy link
Contributor Author

Hi, please provide an update on this PR, whether it needs anything else to be added or if it's good to be merged! Thanks!

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

Successfully merging this pull request may close these issues.

3 participants