@wemap/routers 12.7.2 → 12.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +19 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/remote/RemoteRouterManager.spec.ts +178 -0
- package/src/remote/RemoteRouterManager.ts +20 -5
package/dist/index.js
CHANGED
|
@@ -3887,14 +3887,28 @@ class RemoteRouterManager {
|
|
|
3887
3887
|
}
|
|
3888
3888
|
async getItinerariesWithFallback(routerRequest, fallbackStrategy) {
|
|
3889
3889
|
let itineraries;
|
|
3890
|
+
const errors = [];
|
|
3890
3891
|
for (const { name, endpointUrl } of fallbackStrategy) {
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3892
|
+
try {
|
|
3893
|
+
itineraries = await this.getItineraries(name, endpointUrl, routerRequest);
|
|
3894
|
+
if (itineraries.length) {
|
|
3895
|
+
return itineraries;
|
|
3896
|
+
}
|
|
3897
|
+
} catch (error) {
|
|
3898
|
+
if (error instanceof RemoteRoutingError) {
|
|
3899
|
+
errors.push({
|
|
3900
|
+
name,
|
|
3901
|
+
endpointUrl,
|
|
3902
|
+
error
|
|
3903
|
+
});
|
|
3904
|
+
} else {
|
|
3905
|
+
throw error;
|
|
3906
|
+
}
|
|
3894
3907
|
}
|
|
3895
3908
|
}
|
|
3896
|
-
const routersNames = fallbackStrategy.map(({ name }) => name).join(",");
|
|
3897
|
-
|
|
3909
|
+
const routersNames = fallbackStrategy.map(({ name }) => name).join(", ");
|
|
3910
|
+
const errorsMessages = errors.map((routerError) => `(${routerError.name}) Could not find an itinerary on endpoint: ${routerError.endpointUrl}. Details: ${routerError.error.message}`).join("\n");
|
|
3911
|
+
throw RemoteRoutingError.notFound(routersNames, errorsMessages);
|
|
3898
3912
|
}
|
|
3899
3913
|
}
|
|
3900
3914
|
const RemoteRouterManager$1 = new RemoteRouterManager();
|