diff options
Diffstat (limited to 'platform/qt')
-rw-r--r-- | platform/qt/src/qmapboxgl_map_observer.cpp | 32 | ||||
-rw-r--r-- | platform/qt/src/qmapboxgl_map_observer.hpp | 2 |
2 files changed, 16 insertions, 18 deletions
diff --git a/platform/qt/src/qmapboxgl_map_observer.cpp b/platform/qt/src/qmapboxgl_map_observer.cpp index 44cb8c41d5..4a842026cd 100644 --- a/platform/qt/src/qmapboxgl_map_observer.cpp +++ b/platform/qt/src/qmapboxgl_map_observer.cpp @@ -48,27 +48,25 @@ void QMapboxGLMapObserver::onDidFinishLoadingMap() emit mapChanged(QMapboxGL::MapChangeDidFinishLoadingMap); } -void QMapboxGLMapObserver::onDidFailLoadingMap(std::exception_ptr exception) +void QMapboxGLMapObserver::onDidFailLoadingMap(mbgl::MapLoadError error, const std::string& what) { emit mapChanged(QMapboxGL::MapChangeDidFailLoadingMap); QMapboxGL::MapLoadingFailure type; - QString description; - - try { - std::rethrow_exception(exception); - } catch (const mbgl::util::StyleParseException& e) { - type = QMapboxGL::MapLoadingFailure::StyleParseFailure; - description = e.what(); - } catch (const mbgl::util::StyleLoadException& e) { - type = QMapboxGL::MapLoadingFailure::StyleLoadFailure; - description = e.what(); - } catch (const mbgl::util::NotFoundException& e) { - type = QMapboxGL::MapLoadingFailure::NotFoundFailure; - description = e.what(); - } catch (const std::exception& e) { - type = QMapboxGL::MapLoadingFailure::UnknownFailure; - description = e.what(); + QString description(what.c_str()); + + switch (error) { + case mbgl::MapLoadError::StyleParseError: + type = QMapboxGL::MapLoadingFailure::StyleParseFailure; + break; + case mbgl::MapLoadError::StyleLoadError: + type = QMapboxGL::MapLoadingFailure::StyleLoadFailure; + break; + case mbgl::MapLoadError::NotFoundError: + type = QMapboxGL::MapLoadingFailure::NotFoundFailure; + break; + default: + type = QMapboxGL::MapLoadingFailure::UnknownFailure; } emit mapLoadingFailed(type, description); diff --git a/platform/qt/src/qmapboxgl_map_observer.hpp b/platform/qt/src/qmapboxgl_map_observer.hpp index 98da5b6add..a12e5e9c70 100644 --- a/platform/qt/src/qmapboxgl_map_observer.hpp +++ b/platform/qt/src/qmapboxgl_map_observer.hpp @@ -26,7 +26,7 @@ public: void onCameraDidChange(mbgl::MapObserver::CameraChangeMode) final; void onWillStartLoadingMap() final; void onDidFinishLoadingMap() final; - void onDidFailLoadingMap(std::exception_ptr) final; + void onDidFailLoadingMap(mbgl::MapLoadError, const std::string&) final; void onWillStartRenderingFrame() final; void onDidFinishRenderingFrame(mbgl::MapObserver::RenderMode) final; void onWillStartRenderingMap() final; |