-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add error checking to geocodeStringAndPan #220
Add error checking to geocodeStringAndPan #220
Conversation
src/core/Geocoding.js
Outdated
map.setView([geometry.lat, geometry.lng], options.zoom); | ||
onComplete = onComplete || function onComplete(response) { | ||
if(response.status === "OK") { | ||
let geometry = response.results[0].geometry.location; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what's causing the tests to fail. I've looked for any other instance that is calling this function and why it might be throwing errors but I can't see anything. It's only the tests, for some reason this is causing the tests to not build the BlurredLocation object.
Fixed the testing errors by removing the offending line, it did not want me referring the the results in a variable. Using |
Hi @nstjean, sorry just seeing this just now...rebase should fix this. |
Ok, I'll try running that and see what I get! |
96bfcfb
to
7a0985d
Compare
I think I did it!! I don't know what the rebase did to |
7a0985d
to
12b3318
Compare
Ok updated /dist/ |
package.json
Outdated
@@ -35,6 +35,7 @@ | |||
"resig-class": "^1.0.0" | |||
}, | |||
"dependencies": { | |||
"grunt-cli": "^1.3.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, i think this may need to be in "dev-dependencies" so that it only gets included for developers, not for deployment? not a big deal but good practice. Thank you! https://docs.npmjs.com/specifying-dependencies-and-devdependencies-in-a-package-json-file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh that's interesting. I installed it and didn't realize it would get added in there. I'll move it to dev-dependencies!
@jywarren This should be all set! Hopefully! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Errors are handled nicely here :) Thanks!
|
||
map.setView([geometry.lat, geometry.lng], options.zoom); | ||
onComplete = onComplete || function onComplete(response) { | ||
if(response.status === "OK") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @nstjean , awesome!
Do we have response.code === 200? Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh you mean in addition to the response.status from google we should also check the http response code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes usually i have seen people checking code but i guess status also works fine!
🎉 |
Fixes #214
Prevent hanging when user uses the location autocomplete search if the call returns an error.
Trying this PR again, last branch I think was just too mixed up.