Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

MGLGeoJSONSource does not handle exceptions from GeoJSON parsing #6987

Closed

Description

@jfirebaugh

The following code crashes the application with

libc++abi.dylib: terminating with uncaught exception of type std::runtime_error: Feature must have a geometry property

It should instead raise the error using appropriate cocoa error reporting mechanism.

    MGLGeoJSONSource *geojsonSource = [[MGLGeoJSONSource alloc]
        initWithIdentifier:@"geojson"
               geoJSONData:[@"{\"type\": \"Feature\", \"feature\": {\"type\": \"Point\", \"coordinates\": [0, 0]}}" dataUsingEncoding:NSUTF8StringEncoding]
                   options:nil];

Activity

  1. added
    iOS
    macOS
    on Nov 9, 2016
  2. nitrag commented on Nov 10, 2016

    @nitrag
    Contributor

    In the event that I query several hundred features, I wouldn't want it to fail just because one feature was corrupted and didn't have a geometry. Rather, it should throw a warning and ignore/skip that particular feature.

  3. self-assigned this
    on Dec 11, 2016
  4. added this to the ios-v3.4.0 milestone on Dec 11, 2016
  5. 1ec5 commented on Dec 12, 2016

    @1ec5
    Contributor

    #7334 renamed MGLGeoJSONSource to MGLShapeSource. #7377 removes the crashing initializer in favor of a general-purpose deserialization method (for #3630). This method handles errors gracefully via an NSError out parameter, which is represented as the throws keyword in Swift.

  6. 1ec5 commented on Dec 14, 2016

    @1ec5
    Contributor

    Fixed in #7377 on the iOS SDK v3.4.0 release branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

good first issueiOSmacOSruntime styling

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions