mapbox / mapbox-gl-native

Interactive, thoroughly customizable maps in native Android, iOS, macOS, Node.js, and Qt applications, powered by vector tiles and OpenGL
https://mapbox.com/mobile
Other
4.37k stars 1.33k forks source link

MGLNativeNetworkManager#errorLog drops error details #16511

Closed reidab closed 4 years ago

reidab commented 4 years ago

This is almost a PR, but I don't have time to get the build running locally at the moment.

We've been seeing errors logged from [MGLNetworkConfiguration errorLog:] with incomplete messages that look like Requesting: (null) failed with error: <MGLNetworkConfiguration: 0x60000291ea60>.

Why is the URL (null)? Why is the error an instance of MGLNetworkConfiguration?

That message comes from here:

https://github.com/mapbox/mapbox-gl-native/blob/0895c698d95d8ea35cb7dc35f667736f26f0e098/platform/darwin/src/http_file_source.mm#L279

That line 👆 calls this implementation 👇 of errorLog, passing in a format string as the first arg and the URL path and error object as variadic arguments. When it calls the delegate implementation, it only passes the format string and drops the variadic args.

https://github.com/mapbox/mapbox-gl-native/blob/9e189e02b4a66fa7003631135814b70eff7360ef/platform/darwin/src/native_apple_interface.m#L69-L72

(The matching getError implementation that this calls in https://github.com/mapbox/mapbox-gl-native-ios has the same problem, taking variadic args and again dropping them. I opened https://github.com/mapbox/mapbox-gl-native-ios/issues/347 to track that side.)

julianrex commented 4 years ago

This will be fixed by the next release.