-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Display better message + emit error when bad args are passed to map camera events #4385
Comments
Seems to happen on scroll zoom as well, as seen here #6486 Is this a bug that should be fixed or is it enough to surface better errors? |
I had the same issue when calling |
As a beginner in opensource, I would like to work on this. Can you tell me where I should start looking? |
Thank you @Sugarlust! Just to make sure there's no confusion on this front, Mapbox GL JS is no longer fully open source. Here's the current license. You'll need to sign a contributor's agreement to submit a pull request. The functions in question are in Line 319 in 2bc4599
Line 1448 in 2bc4599
You can look in Lines 2195 to 2198 in 2bc4599
Lastly, we need a unit test for this behavior, probably in The contributor guide will get you set up to develop the library, feel free to ping me with any questions not covered there and to tag me for review on your PR. |
Hey, @SnailBones I checked out the snippets of code you mentioned. Can you tell me what criteria I need to check to fire up the error message in those functions? Also what actually is OBJECT in Line 1448 in 2bc4599
|
I think the criteria should be that the input to the functions is of the correct type. So we should throw the error if the first argument is not a number in
We use Flow for type-checking, it's similar to TypeScript. |
Thanks, @SnailBones, So all I need to do is add an if condition that checks:
is that right? Also if there's an IRC or discussion page please let me know. |
Hey, @SnailBones can you check these out. Do these sound correct what other changes should I make? Also, where can I find the contributor's license to sign, and is there a discussion channel or IRC? |
@Sugarlust looks like you're on the right track to me! I think the error messages could benefit from being more specific, e.g. " The contributor's agreement will be available to you when you submit a PR. |
Hey, @SnailBones I made the error messages a bit more specific. Check these out Also, should I make a PR now? |
A PR would be great, thank you! |
@SnailBones I just made a PR #12098 can you please help me through it, I'm a bit confused? |
Closing this ticket as fixing it in isolation goes against our usage of Flow for type checking. From #12098 (comment):
This issue is still tracked in #9485 and should be considered in the context of broader improvements to error handling. Thank you for your time and contribution @Sugarlust! |
Right now if you call
map.zoomTo([0,0])
we get the 'failed to invert matrix' and the map breaks. We should emit a syntax error with a clear message.Similarly, when you pass a coordinate pair to
map.flyTo
the map doesn't break, it just doesn't do anything. We should emit an error there as well and investigate other potentially affected methods.cc @geografa
The text was updated successfully, but these errors were encountered: