Changesets without closed_at property throw `Cannot read property 'toString' of null` error
jguddas opened this issue · 1 comments
jguddas commented
- I'm submitting a Bug
- bug report
-
feature request - support / question
Brief Description
Loading of some changesets fails.
What is the current behaviour, (attach relevant screenshots) ?
TypeError: Cannot read property 'toString' of null
What is the expected behaviour ?
A better error message or maybe no error at all.
When does this occur ?
When the changeset has no closed_at property.
How do we replicate the issue ?
Example changeset: https://www.openstreetmap.org/api/0.6/changeset/109618303.json?include_discussion=true
Other Information / context:
c.to
can be null
Line 21 in df4dbcb
(null).toString()
does not workchangeset-map/lib/getChangeset.js
Line 79 in df4dbcb
Possible solutions:
- Better error message
var data = getDataParam(changeset);
+ if (!data.to) {
+ new Error('Changeset has no closed_at property!')
+ }
- Not returning null.
- to: cs.closed_at || null,
+ to: cs.closed_at || …,
zstadler commented
A way to provide a map for an open changeset is using an appropriate Overpass query with the one-timestamp variant of the adiff
statement, e.g.,
[adiff:"2012-09-14T15:00:00Z"]
This can be done by
'[out:xml][adiff:%22' +
c.from.toString() +
- ',%22,%22' +
- c.to.toString() +
+ (c.to ? '%22,%22' + c.to.toString() : '') +
'%22];(node(bbox)(changed);way(bbox)(changed);relation(bbox)(changed););out%20meta%20geom(bbox);'
at
changeset-map/lib/getChangeset.js
Lines 81 to 89 in 1b5cbaa