diff options
Diffstat (limited to 'platform/default/src/mbgl/storage/asset_file_source.cpp')
-rw-r--r-- | platform/default/src/mbgl/storage/asset_file_source.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/platform/default/src/mbgl/storage/asset_file_source.cpp b/platform/default/src/mbgl/storage/asset_file_source.cpp index 7988654ae5..ed446f85a5 100644 --- a/platform/default/src/mbgl/storage/asset_file_source.cpp +++ b/platform/default/src/mbgl/storage/asset_file_source.cpp @@ -44,12 +44,13 @@ public: } else if (result == -1 && errno == ENOENT) { response.error = std::make_unique<Response::Error>(Response::Error::Reason::NotFound); } else { - try { - response.data = std::make_shared<std::string>(util::read_file(path)); - } catch (...) { + auto data = util::readFile(path); + if (!data) { response.error = std::make_unique<Response::Error>( Response::Error::Reason::Other, - util::toString(std::current_exception())); + std::string("Cannot read file ") + path); + } else { + response.data = std::make_shared<std::string>(std::move(*data)); } } |