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 error message for missing LngLat data #5880

Closed
nickforddev opened this issue Dec 16, 2017 · 3 comments
Closed

Better error message for missing LngLat data #5880

nickforddev opened this issue Dec 16, 2017 · 3 comments

Comments

@nickforddev
Copy link

mapbox-gl-js version: 1.6.2

Steps to Trigger Behavior

  1. Try to bind a popup to a marker using .setPopup, before .setLngLat, which is not necessarily counterintuitive
const popup = new mapboxgl.Popup()
  .setDOM('<h1>Hello World!</h1>')

const marker = new mapboxgl.Marker()
  .setLngLat([lng, lat])
  .setPopup(popup)
  .addTo(this.map)

Expected Behavior

An error saying that LngLatLike argument is missing altogether?

Actual Behavior

"Error: `LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]"

@jfirebaugh
Copy link
Contributor

I'm not able to replicate the issue. After correcting your example code (setDOMsetHTML), I don't get any errors:

http://jsbin.com/kahufozate/edit?html,output

Can you provide a self-contained example on jsbin that shows the error?

@nickforddev
Copy link
Author

Oh man, apologies for the typo and also for providing code that doesn't throw the error haha, it was a crazy day. I probably copied my code after fixing the problem. Here's the updated JSBin:

http://jsbin.com/kesiyeluqe/edit?html,output

@vuongnguyen-agilityio
Copy link

Hi @jfirebaugh

Thanks for your help.
But sometimes, I still got this issues on v0.53.1
Could you please help to take a look? 🥇

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

No branches or pull requests

3 participants