diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2017-03-07 17:00:53 -0800 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2017-03-23 13:31:13 -0700 |
commit | d7227e13a7a87cf50a4c8c1f0615fc565f5a2679 (patch) | |
tree | eda76a2da3220f3cfeec901400369cf9c8361f58 /src/mbgl/style/sources | |
parent | 1c757cce34344dfecc9a724034680225143f92b7 (diff) | |
download | qtlocation-mapboxgl-d7227e13a7a87cf50a4c8c1f0615fc565f5a2679.tar.gz |
[all] Replace Result<T> with optional<T> plus out Error parameter
Diffstat (limited to 'src/mbgl/style/sources')
-rw-r--r-- | src/mbgl/style/sources/geojson_source_impl.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/mbgl/style/sources/geojson_source_impl.cpp b/src/mbgl/style/sources/geojson_source_impl.cpp index b050e5482e..6431d5faa4 100644 --- a/src/mbgl/style/sources/geojson_source_impl.cpp +++ b/src/mbgl/style/sources/geojson_source_impl.cpp @@ -21,11 +21,12 @@ namespace style { namespace conversion { template <> -Result<GeoJSON> convertGeoJSON(const JSValue& value) { +optional<GeoJSON> convertGeoJSON(const JSValue& value, Error& error) { try { return mapbox::geojson::convert(value); } catch (const std::exception& ex) { - return Error{ ex.what() }; + error = { ex.what() }; + return {}; } } } // namespace conversion @@ -136,10 +137,11 @@ void GeoJSONSource::Impl::loadDescription(FileSource& fileSource) { invalidateTiles(); - conversion::Result<GeoJSON> geoJSON = conversion::convertGeoJSON<JSValue>(d); + conversion::Error error; + optional<GeoJSON> geoJSON = conversion::convertGeoJSON<JSValue>(d, error); if (!geoJSON) { Log::Error(Event::ParseStyle, "Failed to parse GeoJSON data: %s", - geoJSON.error().message.c_str()); + error.message.c_str()); // Create an empty GeoJSON VT object to make sure we're not infinitely waiting for // tiles to load. _setGeoJSON(GeoJSON{ FeatureCollection{} }); |