diff --git a/src/mbgl/style/style_parser.cpp b/src/mbgl/style/style_parser.cpp index 3244839a7..aedb8255c 100644 --- a/src/mbgl/style/style_parser.cpp +++ b/src/mbgl/style/style_parser.cpp @@ -243,12 +243,12 @@ std::tuple> StyleParser::parseProperty(JSVal value, c } template <> -std::tuple StyleParser::parseProperty(JSVal value, const char*) { +std::tuple StyleParser::parseProperty(JSVal value, const char* property_name) { JSVal rvalue = replaceConstant(value); if (rvalue.IsNumber()) { return std::tuple { true, rvalue.GetDouble() }; } else { - Log::Warning(Event::ParseStyle, "function argument must be a numeric value"); + Log::Warning(Event::ParseStyle, "value of '%s' must be a number, or a number function", property_name); return std::tuple { false, 0.0f }; } } @@ -268,20 +268,20 @@ std::tuple>> StyleParser::parseProperty(JSVal val } template <> -std::tuple> StyleParser::parseProperty(JSVal value, const char*) { +std::tuple> StyleParser::parseProperty(JSVal value, const char *property_name) { JSVal rvalue = replaceConstant(value); Faded parsed; if (rvalue.IsString()) { parsed.to = { value.GetString(), value.GetStringLength() }; return std::tuple> { true, parsed }; } else { - Log::Warning(Event::ParseStyle, "function argument must be a string"); + Log::Warning(Event::ParseStyle, "value of '%s' must be a string, or a string function", property_name); return std::tuple> { false, parsed }; } } template -std::tuple>> StyleParser::parseStops(JSVal value_stops) { +std::tuple>> StyleParser::parseStops(JSVal value_stops, const char *property_name) { if (!value_stops.IsArray()) { Log::Warning(Event::ParseStyle, "stops function must specify a stops array"); @@ -304,7 +304,7 @@ std::tuple>> StyleParser::parseStops(JSVal return std::tuple>> { false, {}}; } - stops.emplace_back(z.GetDouble(), std::get<1>(parseProperty(replaceConstant(stop[rapidjson::SizeType(1)]), ""))); + stops.emplace_back(z.GetDouble(), std::get<1>(parseProperty(replaceConstant(stop[rapidjson::SizeType(1)]), property_name))); } else { Log::Warning(Event::ParseStyle, "function argument must be a numeric value"); return std::tuple>> { false, {}}; @@ -317,10 +317,10 @@ template inline float defaultBaseValue() { return 1.75; } template <> inline float defaultBaseValue() { return 1.0; } template -std::tuple> StyleParser::parseFunction(JSVal value, const char *) { +std::tuple> StyleParser::parseFunction(JSVal value, const char *property_name) { if (!value.IsObject()) { - return std::tuple> { true, ConstantFunction(std::get<1>(parseProperty(value, ""))) }; + return std::tuple> { true, ConstantFunction(std::get<1>(parseProperty(value, property_name))) }; } if (!value.HasMember("stops")) { @@ -339,7 +339,7 @@ std::tuple> StyleParser::parseFunction(JSVal value, const char } } - auto stops = parseStops(value["stops"]); + auto stops = parseStops(value["stops"], property_name); if (!std::get<0>(stops)) { return std::tuple> { false, ConstantFunction(T()) }; @@ -355,7 +355,7 @@ std::tuple> StyleParser::parsePiecewiseConsta return std::tuple> { false, {} }; } - auto stops = parseStops(value["stops"]); + auto stops = parseStops(value["stops"], ""); if (!std::get<0>(stops)) { return std::tuple> { false, {} }; diff --git a/src/mbgl/style/style_parser.hpp b/src/mbgl/style/style_parser.hpp index 2f7aa0110..90dd4224e 100644 --- a/src/mbgl/style/style_parser.hpp +++ b/src/mbgl/style/style_parser.hpp @@ -85,7 +85,7 @@ private: template std::tuple> parsePiecewiseConstantFunction(JSVal value, std::chrono::steady_clock::duration duration); template - std::tuple>> parseStops(JSVal value); + std::tuple>> parseStops(JSVal value, const char *property_name); FilterExpression parseFilter(JSVal);