googlemaps / googlemaps/google-maps-services-js

serialization errors get discarded

Open
#811 1 comment 0 reactions 0 assignees View on GitHub
triage me type: bug
Dominant language
TypeScript
Stars
3.1k
Forks
654
Avg merge
3m
Merged PRs (30d)
4

Description

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 ()

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.