AreaMeasurement2DTool error handling

276
1
08-28-2020 12:47 PM
GregoryBologna
Occasional Contributor II

What error handling can I implement to catch this error (or bug)? The error happens when the first point is added to the map and no measurement is made other than double click on top of the first point. Once this error happens the area measure tool completely fails to work without reloading the page.

Uncaught TypeError: Cannot read property 'measurement' of null
at d._updateGraphics (AreaMeasurement2DTool.js:20)
at d._updateSketch (AreaMeasurement2DTool.js:19)
at AreaMeasurement2DTool.js:16
at ?ver=4.16:515
at Array.forEach (<anonymous>)
at c.emit (?ver=4.16:515)
at d.emit (?ver=4.16:517)
at d.n._updateCursor (Sketch.js:405)
at Sketch.js:398
at a._callback (?ver=4.16:2113)

Tags (1)
0 Kudos
1 Reply
Noah-Sager
Esri Regular Contributor

Hi Gregory, sorry, but I cannot reproduce this issue. If I'm understanding correctly, here are my repro steps:

1) app

Measurement in 2D | Sample | ArcGIS API for JavaScript 4.16 

2) tool - AreaMeasurement2D

3) Click once on the map, then double click on the same spot without moving the cursor.

One option would be to use a try/catch in the viewmodel:

AreaMeasurement2DViewModel | ArcGIS API for JavaScript 4.16