Fix missing capitalization of error codes
This commit is contained in:
		
							parent
							
								
									b01c2bc8b8
								
							
						
					
					
						commit
						44c12afc3f
					
				| @ -36,12 +36,12 @@ Status TablePlugin::HandleRequest(const api::TableParameters ¶ms, util::json | |||||||
| 
 | 
 | ||||||
|     if (!CheckAllCoordinates(params.coordinates)) |     if (!CheckAllCoordinates(params.coordinates)) | ||||||
|     { |     { | ||||||
|         return Error("invalid-options", "Coordinates are invalid", result); |         return Error("InvalidOptions", "Coordinates are invalid", result); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (params.bearings.size() > 0 && params.coordinates.size() != params.bearings.size()) |     if (params.bearings.size() > 0 && params.coordinates.size() != params.bearings.size()) | ||||||
|     { |     { | ||||||
|         return Error("invalid-options", "Number of bearings does not match number of coordinates", |         return Error("InvalidOptions", "Number of bearings does not match number of coordinates", | ||||||
|                      result); |                      result); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @ -50,7 +50,7 @@ Status TablePlugin::HandleRequest(const api::TableParameters ¶ms, util::json | |||||||
|          static_cast<std::size_t>(max_locations_distance_table * max_locations_distance_table))) |          static_cast<std::size_t>(max_locations_distance_table * max_locations_distance_table))) | ||||||
|     { |     { | ||||||
|         return Error( |         return Error( | ||||||
|             "invalid-options", |             "InvalidOptions", | ||||||
|             "Number of entries " + |             "Number of entries " + | ||||||
|                 std::to_string(params.sources.size() * params.destinations.size()) + |                 std::to_string(params.sources.size() * params.destinations.size()) + | ||||||
|                 " is higher than current maximum (" + |                 " is higher than current maximum (" + | ||||||
| @ -63,7 +63,7 @@ Status TablePlugin::HandleRequest(const api::TableParameters ¶ms, util::json | |||||||
| 
 | 
 | ||||||
|     if (result_table.empty()) |     if (result_table.empty()) | ||||||
|     { |     { | ||||||
|         return Error("no-table", "No table found", result); |         return Error("NoTable", "No table found", result); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     api::TableAPI table_api{facade, params}; |     api::TableAPI table_api{facade, params}; | ||||||
|  | |||||||
| @ -173,7 +173,7 @@ Status TripPlugin::HandleRequest(const api::TripParameters ¶meters, | |||||||
|     auto phantom_node_pairs = GetPhantomNodes(parameters); |     auto phantom_node_pairs = GetPhantomNodes(parameters); | ||||||
|     if (phantom_node_pairs.size() != parameters.coordinates.size()) |     if (phantom_node_pairs.size() != parameters.coordinates.size()) | ||||||
|     { |     { | ||||||
|         return Error("no-segment", |         return Error("NoSegment", | ||||||
|                      std::string("Could not find a matching segment for coordinate ") + |                      std::string("Could not find a matching segment for coordinate ") + | ||||||
|                          std::to_string(phantom_node_pairs.size()), |                          std::to_string(phantom_node_pairs.size()), | ||||||
|                      json_result); |                      json_result); | ||||||
|  | |||||||
| @ -34,7 +34,7 @@ Status ViaRoutePlugin::HandleRequest(const api::RouteParameters &route_parameter | |||||||
|     if (max_locations_viaroute > 0 && |     if (max_locations_viaroute > 0 && | ||||||
|         (static_cast<int>(route_parameters.coordinates.size()) > max_locations_viaroute)) |         (static_cast<int>(route_parameters.coordinates.size()) > max_locations_viaroute)) | ||||||
|     { |     { | ||||||
|         return Error("too-big", |         return Error("TooBig", | ||||||
|                      "Number of entries " + std::to_string(route_parameters.coordinates.size()) + |                      "Number of entries " + std::to_string(route_parameters.coordinates.size()) + | ||||||
|                          " is higher than current maximum (" + |                          " is higher than current maximum (" + | ||||||
|                          std::to_string(max_locations_viaroute) + ")", |                          std::to_string(max_locations_viaroute) + ")", | ||||||
| @ -43,13 +43,13 @@ Status ViaRoutePlugin::HandleRequest(const api::RouteParameters &route_parameter | |||||||
| 
 | 
 | ||||||
|     if (!CheckAllCoordinates(route_parameters.coordinates)) |     if (!CheckAllCoordinates(route_parameters.coordinates)) | ||||||
|     { |     { | ||||||
|         return Error("invalid-value", "Invalid coordinate value.", json_result); |         return Error("InvalidValue", "Invalid coordinate value.", json_result); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     auto phantom_node_pairs = GetPhantomNodes(route_parameters); |     auto phantom_node_pairs = GetPhantomNodes(route_parameters); | ||||||
|     if (phantom_node_pairs.size() != route_parameters.coordinates.size()) |     if (phantom_node_pairs.size() != route_parameters.coordinates.size()) | ||||||
|     { |     { | ||||||
|         return Error("no-segment", |         return Error("NoSegment", | ||||||
|                      std::string("Could not find a matching segment for coordinate ") + |                      std::string("Could not find a matching segment for coordinate ") + | ||||||
|                          std::to_string(phantom_node_pairs.size()), |                          std::to_string(phantom_node_pairs.size()), | ||||||
|                      json_result); |                      json_result); | ||||||
| @ -100,11 +100,11 @@ Status ViaRoutePlugin::HandleRequest(const api::RouteParameters &route_parameter | |||||||
| 
 | 
 | ||||||
|         if (not_in_same_component) |         if (not_in_same_component) | ||||||
|         { |         { | ||||||
|             return Error("no-route", "Impossible route between points", json_result); |             return Error("NoRoute", "Impossible route between points", json_result); | ||||||
|         } |         } | ||||||
|         else |         else | ||||||
|         { |         { | ||||||
|             return Error("no-route", "No route found between points", json_result); |             return Error("NoRoute", "No route found between points", json_result); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -107,7 +107,7 @@ void RequestHandler::HandleRequest(const http::request ¤t_request, http::r | |||||||
|             current_reply.status = http::reply::bad_request; |             current_reply.status = http::reply::bad_request; | ||||||
|             result = util::json::Object(); |             result = util::json::Object(); | ||||||
|             auto &json_result = result.get<util::json::Object>(); |             auto &json_result = result.get<util::json::Object>(); | ||||||
|             json_result.values["code"] = "invalid-url"; |             json_result.values["code"] = "InvalidUrl"; | ||||||
|             json_result.values["message"] = "URL string malformed close to position " + |             json_result.values["message"] = "URL string malformed close to position " + | ||||||
|                                             std::to_string(position) + ": \"" + context + "\""; |                                             std::to_string(position) + ": \"" + context + "\""; | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -51,7 +51,7 @@ engine::Status MatchService::RunQuery(std::string &query, ResultT &result) | |||||||
|     if (!parameters || query_iterator != query.end()) |     if (!parameters || query_iterator != query.end()) | ||||||
|     { |     { | ||||||
|         const auto position = std::distance(query.begin(), query_iterator); |         const auto position = std::distance(query.begin(), query_iterator); | ||||||
|         json_result.values["code"] = "invalid-query"; |         json_result.values["code"] = "InvalidQuery"; | ||||||
|         json_result.values["message"] = |         json_result.values["message"] = | ||||||
|             "Query string malformed close to position " + std::to_string(position); |             "Query string malformed close to position " + std::to_string(position); | ||||||
|         return engine::Status::Error; |         return engine::Status::Error; | ||||||
| @ -60,7 +60,7 @@ engine::Status MatchService::RunQuery(std::string &query, ResultT &result) | |||||||
|     BOOST_ASSERT(parameters); |     BOOST_ASSERT(parameters); | ||||||
|     if (!parameters->IsValid()) |     if (!parameters->IsValid()) | ||||||
|     { |     { | ||||||
|         json_result.values["code"] = "invalid-options"; |         json_result.values["code"] = "InvalidOptions"; | ||||||
|         json_result.values["message"] = getWrongOptionHelp(*parameters); |         json_result.values["message"] = getWrongOptionHelp(*parameters); | ||||||
|         return engine::Status::Error; |         return engine::Status::Error; | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -50,7 +50,7 @@ engine::Status NearestService::RunQuery(std::string &query, ResultT &result) | |||||||
|     if (!parameters || query_iterator != query.end()) |     if (!parameters || query_iterator != query.end()) | ||||||
|     { |     { | ||||||
|         const auto position = std::distance(query.begin(), query_iterator); |         const auto position = std::distance(query.begin(), query_iterator); | ||||||
|         json_result.values["code"] = "invalid-query"; |         json_result.values["code"] = "InvalidQuery"; | ||||||
|         json_result.values["message"] = |         json_result.values["message"] = | ||||||
|             "Query string malformed close to position " + std::to_string(position); |             "Query string malformed close to position " + std::to_string(position); | ||||||
|         return engine::Status::Error; |         return engine::Status::Error; | ||||||
| @ -59,7 +59,7 @@ engine::Status NearestService::RunQuery(std::string &query, ResultT &result) | |||||||
| 
 | 
 | ||||||
|     if (!parameters->IsValid()) |     if (!parameters->IsValid()) | ||||||
|     { |     { | ||||||
|         json_result.values["code"] = "invalid-options"; |         json_result.values["code"] = "InvalidOptions"; | ||||||
|         json_result.values["message"] = getWrongOptionHelp(*parameters); |         json_result.values["message"] = getWrongOptionHelp(*parameters); | ||||||
|         return engine::Status::Error; |         return engine::Status::Error; | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -49,7 +49,7 @@ engine::Status RouteService::RunQuery(std::string &query, ResultT &result) | |||||||
|     if (!parameters || query_iterator != query.end()) |     if (!parameters || query_iterator != query.end()) | ||||||
|     { |     { | ||||||
|         const auto position = std::distance(query.begin(), query_iterator); |         const auto position = std::distance(query.begin(), query_iterator); | ||||||
|         json_result.values["code"] = "invalid-query"; |         json_result.values["code"] = "InvalidQuery"; | ||||||
|         json_result.values["message"] = |         json_result.values["message"] = | ||||||
|             "Query string malformed close to position " + std::to_string(position); |             "Query string malformed close to position " + std::to_string(position); | ||||||
|         return engine::Status::Error; |         return engine::Status::Error; | ||||||
| @ -58,7 +58,7 @@ engine::Status RouteService::RunQuery(std::string &query, ResultT &result) | |||||||
| 
 | 
 | ||||||
|     if (!parameters->IsValid()) |     if (!parameters->IsValid()) | ||||||
|     { |     { | ||||||
|         json_result.values["code"] = "invalid-options"; |         json_result.values["code"] = "InvalidOptions"; | ||||||
|         json_result.values["message"] = getWrongOptionHelp(*parameters); |         json_result.values["message"] = getWrongOptionHelp(*parameters); | ||||||
|         return engine::Status::Error; |         return engine::Status::Error; | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -68,7 +68,7 @@ engine::Status TableService::RunQuery(std::string &query, ResultT &result) | |||||||
|     if (!parameters || query_iterator != query.end()) |     if (!parameters || query_iterator != query.end()) | ||||||
|     { |     { | ||||||
|         const auto position = std::distance(query.begin(), query_iterator); |         const auto position = std::distance(query.begin(), query_iterator); | ||||||
|         json_result.values["code"] = "invalid-query"; |         json_result.values["code"] = "InvalidQuery"; | ||||||
|         json_result.values["message"] = |         json_result.values["message"] = | ||||||
|             "Query string malformed close to position " + std::to_string(position); |             "Query string malformed close to position " + std::to_string(position); | ||||||
|         return engine::Status::Error; |         return engine::Status::Error; | ||||||
| @ -77,7 +77,7 @@ engine::Status TableService::RunQuery(std::string &query, ResultT &result) | |||||||
| 
 | 
 | ||||||
|     if (!parameters->IsValid()) |     if (!parameters->IsValid()) | ||||||
|     { |     { | ||||||
|         json_result.values["code"] = "invalid-options"; |         json_result.values["code"] = "InvalidOptions"; | ||||||
|         json_result.values["message"] = getWrongOptionHelp(*parameters); |         json_result.values["message"] = getWrongOptionHelp(*parameters); | ||||||
|         return engine::Status::Error; |         return engine::Status::Error; | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -25,7 +25,7 @@ engine::Status TileService::RunQuery(std::string &query, ResultT &result) | |||||||
|         const auto position = std::distance(query.begin(), query_iterator); |         const auto position = std::distance(query.begin(), query_iterator); | ||||||
|         result = util::json::Object(); |         result = util::json::Object(); | ||||||
|         auto &json_result = result.get<util::json::Object>(); |         auto &json_result = result.get<util::json::Object>(); | ||||||
|         json_result.values["code"] = "invalid-query"; |         json_result.values["code"] = "InvalidQuery"; | ||||||
|         json_result.values["message"] = |         json_result.values["message"] = | ||||||
|             "Query string malformed close to position " + std::to_string(position); |             "Query string malformed close to position " + std::to_string(position); | ||||||
|         return engine::Status::Error; |         return engine::Status::Error; | ||||||
| @ -36,7 +36,7 @@ engine::Status TileService::RunQuery(std::string &query, ResultT &result) | |||||||
|     { |     { | ||||||
|         result = util::json::Object(); |         result = util::json::Object(); | ||||||
|         auto &json_result = result.get<util::json::Object>(); |         auto &json_result = result.get<util::json::Object>(); | ||||||
|         json_result.values["code"] = "invalid-options"; |         json_result.values["code"] = "InvalidOptions"; | ||||||
|         json_result.values["message"] = "Invalid coodinates. Only zoomlevel 12+ is supported"; |         json_result.values["message"] = "Invalid coodinates. Only zoomlevel 12+ is supported"; | ||||||
|         return engine::Status::Error; |         return engine::Status::Error; | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -51,7 +51,7 @@ engine::Status TripService::RunQuery(std::string &query, ResultT &result) | |||||||
|         const auto position = std::distance(query.begin(), query_iterator); |         const auto position = std::distance(query.begin(), query_iterator); | ||||||
|         result = util::json::Object(); |         result = util::json::Object(); | ||||||
|         auto &json_result = result.get<util::json::Object>(); |         auto &json_result = result.get<util::json::Object>(); | ||||||
|         json_result.values["code"] = "invalid-query"; |         json_result.values["code"] = "InvalidQuery"; | ||||||
|         json_result.values["message"] = |         json_result.values["message"] = | ||||||
|             "Query string malformed close to position " + std::to_string(position); |             "Query string malformed close to position " + std::to_string(position); | ||||||
|         return engine::Status::Error; |         return engine::Status::Error; | ||||||
| @ -60,7 +60,7 @@ engine::Status TripService::RunQuery(std::string &query, ResultT &result) | |||||||
| 
 | 
 | ||||||
|     if (!parameters->IsValid()) |     if (!parameters->IsValid()) | ||||||
|     { |     { | ||||||
|         json_result.values["code"] = "invalid-options"; |         json_result.values["code"] = "InvalidOptions"; | ||||||
|         json_result.values["message"] = getWrongOptionHelp(*parameters); |         json_result.values["message"] = getWrongOptionHelp(*parameters); | ||||||
|         return engine::Status::Error; |         return engine::Status::Error; | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -33,7 +33,7 @@ engine::Status ServiceHandler::RunQuery(api::ParsedURL parsed_url, | |||||||
|     { |     { | ||||||
|         result = util::json::Object(); |         result = util::json::Object(); | ||||||
|         auto &json_result = result.get<util::json::Object>(); |         auto &json_result = result.get<util::json::Object>(); | ||||||
|         json_result.values["code"] = "invalid-service"; |         json_result.values["code"] = "InvalidService"; | ||||||
|         json_result.values["message"] = "Service " + parsed_url.service + " not found!"; |         json_result.values["message"] = "Service " + parsed_url.service + " not found!"; | ||||||
|         return engine::Status::Error; |         return engine::Status::Error; | ||||||
|     } |     } | ||||||
| @ -43,7 +43,7 @@ engine::Status ServiceHandler::RunQuery(api::ParsedURL parsed_url, | |||||||
|     { |     { | ||||||
|         result = util::json::Object(); |         result = util::json::Object(); | ||||||
|         auto &json_result = result.get<util::json::Object>(); |         auto &json_result = result.get<util::json::Object>(); | ||||||
|         json_result.values["code"] = "invalid-version"; |         json_result.values["code"] = "InvalidVersion"; | ||||||
|         json_result.values["message"] = "Service " + parsed_url.service + " not found!"; |         json_result.values["message"] = "Service " + parsed_url.service + " not found!"; | ||||||
|         return engine::Status::Error; |         return engine::Status::Error; | ||||||
|     } |     } | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user