Troubleshoot errors
Stay organized with collections
Save and categorize content based on your preferences.
This section describes how to handle errors.
Handle update_mask errors
An update_mask
error can occur when the updateMask
query parameter is
empty. To prevent this error, always provide at least one field name. It
typically occurs for the first update after startup. For more information about
updating vehicle fields in Fleet Engine, see Update vehicle fields.
The following example shows how to handle this error:
Swift
import GoogleRidesharingDriver
class VehicleReporterListener: NSObject, GMTDVehicleReporterListener {
func vehicleReporter(
_ vehicleReporter: GMTDVehicleReporter,
didFail vehicleUpdate: GMTDVehicleUpdate,
withError error: Error
) {
let fullError = error as NSError
if let innerError = fullError.userInfo[NSUnderlyingErrorKey] as? NSError {
let innerFullError = innerError as NSError
if innerFullError.localizedDescription.contains("update_mask cannot be empty") {
emptyMaskUpdates += 1
return
}
}
failedUpdates += 1
}
override init() {
emptyMaskUpdates = 0
failedUpdates = 0
}
}
Objective-C
#import "VehicleReporterListener.h"
#import <GoogleRidesharingDriver/GoogleRidesharingDriver.h>
@implementation VehicleReporterListener {
NSInteger emptyMaskUpdates = 0;
NSInteger failedUpdates = 0;
}
- (void)vehicleReporter:(GMTDVehicleReporter *)vehicleReporter
didFailVehicleUpdate:(GMTDVehicleUpdate *)vehicleUpdate
withError:(NSError *)error {
for (NSError *underlyingError in error.underlyingErrors) {
if ([underlyingError.localizedDescription containsString:@"update_mask cannot be empty"]) {
emptyMaskUpdates += 1;
return;
}
}
failedUpdates += 1
}
@end
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-09-03 UTC.
[null,null,["Last updated 2025-09-03 UTC."],[[["\u003cp\u003e\u003ccode\u003eupdate_mask\u003c/code\u003e errors arise when the \u003ccode\u003eupdateMask\u003c/code\u003e query parameter is empty during vehicle updates, particularly after startup.\u003c/p\u003e\n"],["\u003cp\u003eTo avoid these errors, always include at least one field name in the \u003ccode\u003eupdateMask\u003c/code\u003e parameter when updating vehicle data.\u003c/p\u003e\n"],["\u003cp\u003eThe provided code examples (Swift and Objective-C) demonstrate how to identify and manage \u003ccode\u003eupdate_mask\u003c/code\u003e errors within your application's error handling logic.\u003c/p\u003e\n"]]],["`update_mask` errors occur when the `updateMask` query parameter is empty, especially during the first update after startup. To avoid this, always include at least one field name in the parameter. The provided code examples in Swift and Objective-C demonstrate error handling. They check if the error description contains \"update_mask cannot be empty\" to identify and manage these specific errors, counting both successful `update_mask` error instances and other failed updates.\n"],null,["# Troubleshoot errors\n\nThis section describes how to handle errors.\n\nHandle update_mask errors\n-------------------------\n\nAn `update_mask` error can occur when the [`updateMask`](/maps/documentation/mobility/fleet-engine/reference/trips/rest/v1/providers.vehicles/update#body.QUERY_PARAMETERS.update_mask) query parameter is\nempty. To prevent this error, always provide at least one field name. It\ntypically occurs for the first update after startup. For more information about\nupdating vehicle fields in Fleet Engine, see [Update vehicle fields](/maps/documentation/mobility/fleet-engine/essentials/vehicles/on-demand-vehicle-fields).\n\nThe following example shows how to handle this error: \n\n### Swift\n\n import GoogleRidesharingDriver\n\n class VehicleReporterListener: NSObject, GMTDVehicleReporterListener {\n func vehicleReporter(\n _ vehicleReporter: GMTDVehicleReporter,\n didFail vehicleUpdate: GMTDVehicleUpdate,\n withError error: Error\n ) {\n let fullError = error as NSError\n if let innerError = fullError.userInfo[NSUnderlyingErrorKey] as? NSError {\n let innerFullError = innerError as NSError\n if innerFullError.localizedDescription.contains(\"update_mask cannot be empty\") {\n emptyMaskUpdates += 1\n return\n }\n }\n failedUpdates += 1\n }\n\n override init() {\n emptyMaskUpdates = 0\n failedUpdates = 0\n }\n }\n\n### Objective-C\n\n #import \"VehicleReporterListener.h\"\n #import \u003cGoogleRidesharingDriver/GoogleRidesharingDriver.h\u003e\n\n @implementation VehicleReporterListener {\n NSInteger emptyMaskUpdates = 0;\n NSInteger failedUpdates = 0;\n }\n\n - (void)vehicleReporter:(GMTDVehicleReporter *)vehicleReporter\n didFailVehicleUpdate:(GMTDVehicleUpdate *)vehicleUpdate\n withError:(NSError *)error {\n for (NSError *underlyingError in error.underlyingErrors) {\n if ([underlyingError.localizedDescription containsString:@\"update_mask cannot be empty\"]) {\n emptyMaskUpdates += 1;\n return;\n }\n }\n failedUpdates += 1\n }\n\n @end"]]