google-maps-services-js icon indicating copy to clipboard operation
google-maps-services-js copied to clipboard

serialization errors get discarded

Open greghutch opened this issue 3 years ago • 1 comments

I was trying to create directions request with waypoints and passed a bad waypoint object in (extra nesting object around that {lat:..., lng:..} in the array. Effectively waypoints: [ {{lat:.., lng}}, ...].

Which resulted in this error being given back:

/Users/ghutchins/gob/datasets-routing-playground-launch/node_modules/@googlemaps/google-maps-services-js/node_modules/axios/lib/adapters/http.js:144 var customErr = new Error(err.message); ^

Error at dispatchHttpRequest (/Users/ghutchins/gob/datasets-routing-playground-launch/node_modules/@googlemaps/google-maps-services-js/node_modules/axios/lib/adapters/http.js:144:23) at new Promise () at Object.httpAdapter [as adapter] (/Users/ghutchins/gob/datasets-routing-playground-launch/node_modules/@googlemaps/google-maps-services-js/node_modules/axios/lib/adapters/http.js:48:10) at /Users/ghutchins/gob/datasets-routing-playground-launch/node_modules/@googlemaps/google-maps-services-js/dist/adapter.js:55:10 at new Promise () at customAdapter (/Users/ghutchins/gob/datasets-routing-playground-launch/node_modules/@googlemaps/google-maps-services-js/dist/adapter.js:53:35) at dispatchRequest (/Users/ghutchins/gob/datasets-routing-playground-launch/node_modules/axios/lib/core/dispatchRequest.js:58:10) at Axios.request (/Users/ghutchins/gob/datasets-routing-playground-launch/node_modules/axios/lib/core/Axios.js:108:15) at Function.wrap [as request] (/Users/ghutchins/gob/datasets-routing-playground-launch/node_modules/axios/lib/helpers/bind.js:9:15) at /Users/ghutchins/gob/datasets-routing-playground-launch/node_modules/retry-axios/dist/index.js:1:1819 {

Not very useful.

Once I added a console.log(...) to the above line in http.js

I got a better error message:

gots TypeError at latLngToString (/Users/ghutchins/gob/datasets-routing-playground-launch/node_modules/@googlemaps/google-maps-services-js/dist/serialize.js:37:15) at Array.map () at Object.waypoints (/Users/ghutchins/gob/datasets-routing-playground-launch/node_modules/@googlemaps/google-maps-services-js/dist/directions.js:36:25) at /Users/ghutchins/gob/datasets-routing-playground-launch/node_modules/@googlemaps/google-maps-services-js/dist/serialize.js:109:52 at Array.forEach () at /Users/ghutchins/gob/datasets-routing-playground-launch/node_modules/@googlemaps/google-maps-services-js/dist/serialize.js:107:29 at buildURL (/Users/ghutchins/gob/datasets-routing-playground-launch/node_modules/@googlemaps/google-maps-services-js/node_modules/axios/lib/helpers/buildURL.js:30:24) at dispatchHttpRequest (/Users/ghutchins/gob/datasets-routing-playground-launch/node_modules/@googlemaps/google-maps-services-js/node_modules/axios/lib/adapters/http.js:142:7) at new Promise ()

greghutch avatar May 12 '22 21:05 greghutch

Might be caused by https://github.com/googlemaps/google-maps-services-js/blob/ba74bac126ee1bd37bb4c5ce917347d31c3ecb42/src/adapter.ts#L65

jpoehnelt avatar May 16 '22 14:05 jpoehnelt