wearethoughtfox / amnesty-facebook

0 stars 0 forks source link

Sometimes, we get response.location.name error in the console #51

Closed pauldwaite closed 7 years ago

pauldwaite commented 7 years ago

I haven’t yet had time to narrow down when this occurs — I’ve definitely seen it on iOS with our test users, but it may occur elsewhere.

response-location-name

pauldwaite commented 7 years ago

Here we go:

sdk.js:109 Uncaught TypeError: Cannot read property 'name' of undefined
    at person.js:35
    at v.__wrapper (sdk.js:109)
    at ma (sdk.js:119)
    at Object.w (sdk.js:117)
    at Object.<anonymous> (sdk.js:55)
    at me?access_token=EAACHIGP0fzYBAINSCBDONSWbtuvfcYZAwejfhK9Lv1ku0L5GPES1HpVBITYBq9RNzDeSwCRq4HyVZAXZCx…:1

This line, in Person.js:

"location": response.location.name

So I think it’s when the user doesn’t have a location. Possible fix:

"location": (response.location && response.location.name || "")
pauldwaite commented 7 years ago

I think this is fixed now.