Skip to content

Changesets without closed_at property throw Cannot read property 'toString' of null error #240

Open
@jguddas

Description

@jguddas
  • 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

to: cs.closed_at || null,

(null).toString() does not work
c.to.toString() +

Possible solutions:

  1. Better error message
var data = getDataParam(changeset);
+ if (!data.to) {
+   new Error('Changeset has no closed_at property!')
+ }
  1. Not returning null.
- to: cs.closed_at || null,
+ to: cs.closed_at || …,

Metadata

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