Skip to content

Commit

Permalink
Minor addition to Consolidated loading, #682:
Browse files Browse the repository at this point in the history
The /config/layers is not a valid endpoint in V2 API (because /config/map_1 already returns layers). The file 'layers' does exist however, so we must take care of this to eliminate a potential problem where V2 Client would try to call the V1 endpoint.
I added a basic error message that clarifies what's going on and how to fix it.
  • Loading branch information
jacobwod committed Mar 3, 2021
1 parent baca1b8 commit d18a990
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion new-backend/server/api/services/config.service.v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,17 @@ class ConfigServiceV2 {
*/
async getMapWithLayers(map, user, washContent = true) {
logger.trace(
"[getMapWithLayers] invoked with 'washContent=%s' for user %s. Grabbing %s map config and all layers.",
"[getMapWithLayers] invoked with 'washContent=%s' for user %s. Grabbing '%s' map config and all layers.",
washContent,
user,
map
);

try {
if (map === "layers")
throw new Error(
`"layers" is not a valid map config name. It looks like you are trying to access a v1 endpoint on the v2 API. Try adding "experimentalNewApi": true to Client's appConfig.json.`
);
// First, let's get the map config. From there we will be able
// to figure out which layers are needed, and if UserSpecificMaps
// should be present.
Expand Down

0 comments on commit d18a990

Please sign in to comment.