diff --git a/lib/rest-exe-errors.js b/lib/rest-exe-errors.js index 17d3c32c0..6df898af5 100644 --- a/lib/rest-exe-errors.js +++ b/lib/rest-exe-errors.js @@ -146,9 +146,11 @@ const byErrorCode = Object.assign(Object.create(null), { message: 'trip is cancelled', props: { }, - } + }, }) +// todo: "server returned bogus data" error + export { // all from ./errors.js ACCESS_DENIED, diff --git a/parse-rest/trip.js b/parse-rest/trip.js index a6a56a622..e5f570980 100644 --- a/parse-rest/trip.js +++ b/parse-rest/trip.js @@ -10,6 +10,10 @@ const parseTrip = (ctx, t) => { const stopovers = sortBy(t.stops || [], 'routeIdx') .map(st => profile.parseStopover(ctx, st)) + if (stopovers.length === 0) { + // todo: throw "server returned bogus data" error + } + const dep = stopovers[0] const arr = last(stopovers)