Skip to content

Commit

Permalink
fix 3 unhandled exceptions in lib/geojson
Browse files Browse the repository at this point in the history
  • Loading branch information
dmfenton committed Nov 11, 2015
1 parent d262fed commit a5069bd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## Unreleased
### Fixed
* Remove 3 causes of unhandled exceptions in lib/geojson

## [2.10.2] - 2015-11-10
### Fixed
* Clean up file on local disk after single page export
Expand Down
14 changes: 11 additions & 3 deletions lib/GeoJSON.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ function transformFeature (feature, fields) {
// convert attribute expects an actual object and not just the values
var attr = {}
attr[name] = feature.attributes[name]
attributes[fields[name].outName] = convertAttribute(attr, fields[name])
try {
attributes[fields[name].outName] = convertAttribute(attr, fields[name])
} catch (e) {
console.error('Field was missing from attribute')
}
})
}

Expand Down Expand Up @@ -164,10 +168,14 @@ function convertAttribute (attribute, field) {
var inValue = attribute[field.name]
var value
if (inValue === null) return inValue
if (field.domain) {
if (field.domain && field.domain.type === 'codedValue') {
value = cvd(inValue, field)
} else if (field.type === 'esriFieldTypeDate') {
value = new Date(inValue).toISOString()
try {
value = new Date(inValue).toISOString()
} catch (e) {
value = inValue
}
} else {
value = inValue
}
Expand Down

0 comments on commit a5069bd

Please sign in to comment.