Skip to content

Better error message for missing LngLat data #5880

Closed
@nickforddev

Description

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>]"

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions