Google. Maps. Event. MapLoadErrorArgs
Encapsulates the set of arguments for MapEvents.LoadError.
Summary
When part of the map fails to load after a call to MapsService.LoadMap, a MapEvents.LoadError event is fired before attempting to load it again. A listener can modify the fields of MapLoadErrorArgs
to change whether it will retry, and if so, after what delay.
The default behavior starts with a delay of 0.5 seconds with 1.0 jitter, doubling the delay with each attempt, up to 3 attempts.
Recommendations
- Handle MapEvents.LoadError events and log ErrorArgs.ToString to the console.
- On ErrorArgs.DetailedErrorEnum.UnsupportedClientVersion, notify the user that they must update the app.
- If requests regularly time-out (ErrorArgs.DetailedErrorEnum.NetworkError with ErrorArgs.Message == "Request timeout"), then consider increasing MapsService.NetworkTimeoutSeconds.
- If requests time-out mainly on slow networks, consider increasing the number of retries instead (set Retry to true if Attempts <= a value greater than 3).
- Don't change TimeoutSeconds or DelaySeconds.
Example
mapsService.Events.MapEvents.LoadError.AddListener(e => {
if (e.DetailedErrorCode == DetailedErrorEnum.UnsupportedClientVersion) {
log.Error("Update app to latest version");
return;
}
// Retry up to 5 attempts.
e.Retry = e.Attempts <= 5;
// Log to the console.
if (e.Retry && e.IsRetriable) {
log.Warning(e);
} else {
log.Error(e);
}
});
Inheritance
Inherits from: Google.Maps.Event.ErrorArgs
Public attributes |
|
---|---|
Attempts
|
readonly int
The number of attempts at loading this part of the map.
|
DelaySeconds
|
float
The length of time to wait before retrying.
|
IsRetriable
|
readonly bool
Indicates whether the request can be retried.
|
Retry
|
bool
Indicates whether to retry loading this part of the map.
|
TimeoutSeconds
|
int
The number of seconds to wait for the response from the server after sending the next request.
|
Public functions |
|
---|---|
GetBounds(Projection projection)
|
Bounds
Gets the bounds of the area that failed to load.
|
Public attributes
Attempts
readonly int Attempts
The number of attempts at loading this part of the map.
DelaySeconds
float DelaySeconds
The length of time to wait before retrying.
Event listeners can modify this value to change the behavior.
IsRetriable
readonly bool IsRetriable
Indicates whether the request can be retried.
Retry
bool Retry
Indicates whether to retry loading this part of the map.
Event listeners can modify this value to change the behavior.
But it has no effect if IsRetriable is true.
TimeoutSeconds
int TimeoutSeconds
The number of seconds to wait for the response from the server after sending the next request.
If set to 0, the next attempts waits forever.
Public functions
GetBounds
Bounds GetBounds( Projection projection )
Gets the bounds of the area that failed to load.
Details | |||
---|---|---|---|
Parameters |
|