[core] Emit MapChangeDidFailLoadingMap when the style cannot be loaded or parsed
Currently this signal is never emitted, which can cause the Still mode to starve in case of an invalid style or failed request.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"default": {
|
||||
"log": [
|
||||
[1, "ERROR", "ParseStyle", "Style JSON must be an object"]
|
||||
[1, "ERROR", "ParseStyle", "Failed to parse style: style must be an object"]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ TEST(Map, SetStyleInvalidJSON) {
|
||||
auto observer = Log::removeObserver();
|
||||
auto flo = dynamic_cast<FixtureLogObserver*>(observer.get());
|
||||
EXPECT_EQ(1u, flo->count({ EventSeverity::Error, Event::ParseStyle, -1,
|
||||
"Error parsing style JSON at 0: Invalid value." }));
|
||||
"Failed to parse style: 0 - Invalid value." }));
|
||||
auto unchecked = flo->unchecked();
|
||||
EXPECT_TRUE(unchecked.empty()) << unchecked;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <mbgl/style/parser.hpp>
|
||||
#include <mbgl/util/io.hpp>
|
||||
#include <mbgl/util/enum.hpp>
|
||||
#include <mbgl/util/string.hpp>
|
||||
#include <mbgl/util/tileset.hpp>
|
||||
|
||||
#include <rapidjson/document.h>
|
||||
@@ -32,7 +33,11 @@ TEST_P(StyleParserTest, ParseStyle) {
|
||||
Log::setObserver(std::unique_ptr<Log::Observer>(observer));
|
||||
|
||||
style::Parser parser;
|
||||
parser.parse(util::read_file(base + ".style.json"));
|
||||
auto error = parser.parse(util::read_file(base + ".style.json"));
|
||||
|
||||
if (error) {
|
||||
Log::Error(Event::ParseStyle, "Failed to parse style: %s", util::toString(error).c_str());
|
||||
}
|
||||
|
||||
for (auto it = infoDoc.MemberBegin(), end = infoDoc.MemberEnd(); it != end; it++) {
|
||||
const std::string name { it->name.GetString(), it->name.GetStringLength() };
|
||||
|
||||
Reference in New Issue
Block a user