summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjmkiley <jordan.kiley@mapbox.com>2019-07-15 15:26:25 -0700
committerjmkiley <jordan.kiley@mapbox.com>2019-07-15 15:26:25 -0700
commit46544ce7e5da3f106aa6fd7d5cfa3a01604f0269 (patch)
tree2f3f9948529786735bd8fe7bd978e8c419633092
parent226718f904af51a41fd9e85650713dffdf3095a9 (diff)
downloadqtlocation-mapboxgl-46544ce7e5da3f106aa6fd7d5cfa3a01604f0269.tar.gz
[ios] Add MGLErrorCodeOfflineDatabase
-rw-r--r--platform/darwin/src/MGLOfflineStorage.mm16
-rw-r--r--platform/darwin/src/MGLTypes.h4
2 files changed, 11 insertions, 9 deletions
diff --git a/platform/darwin/src/MGLOfflineStorage.mm b/platform/darwin/src/MGLOfflineStorage.mm
index 7ad04deb33..dc51666d0a 100644
--- a/platform/darwin/src/MGLOfflineStorage.mm
+++ b/platform/darwin/src/MGLOfflineStorage.mm
@@ -340,7 +340,7 @@ const MGLExceptionName MGLUnsupportedRegionTypeException = @"MGLUnsupportedRegio
NSMutableArray *packs;
if (!result) {
NSString *description = [NSString stringWithFormat:NSLocalizedStringWithDefaultValue(@"ADD_FILE_CONTENTS_FAILED_DESC", @"Foundation", nil, @"Unable to add offline packs from the file at %@.", @"User-friendly error description"), filePath];
- error = [NSError errorWithDomain:MGLErrorDomain code:-1 userInfo:@{
+ error = [NSError errorWithDomain:MGLErrorDomain code:9 userInfo:@{
NSLocalizedDescriptionKey: description,
NSLocalizedFailureReasonErrorKey: @(mbgl::util::toString(result.error()).c_str())
}];
@@ -400,7 +400,7 @@ const MGLExceptionName MGLUnsupportedRegionTypeException = @"MGLUnsupportedRegio
NSError *error;
if (!mbglOfflineRegion) {
NSString *errorDescription = @(mbgl::util::toString(mbglOfflineRegion.error()).c_str());
- error = [NSError errorWithDomain:MGLErrorDomain code:-1 userInfo:errorDescription ? @{
+ error = [NSError errorWithDomain:MGLErrorDomain code:9 userInfo:errorDescription ? @{
NSLocalizedDescriptionKey: errorDescription,
} : nil];
}
@@ -433,7 +433,7 @@ const MGLExceptionName MGLUnsupportedRegionTypeException = @"MGLUnsupportedRegio
_mbglFileSource->deleteOfflineRegion(std::move(*mbglOfflineRegion), [&, completion](std::exception_ptr exception) {
NSError *error;
if (exception) {
- error = [NSError errorWithDomain:MGLErrorDomain code:-1 userInfo:@{
+ error = [NSError errorWithDomain:MGLErrorDomain code:9 userInfo:@{
NSLocalizedDescriptionKey: @(mbgl::util::toString(exception).c_str()),
}];
}
@@ -456,7 +456,7 @@ const MGLExceptionName MGLUnsupportedRegionTypeException = @"MGLUnsupportedRegio
_mbglFileSource->invalidateOfflineRegion(region, [&](std::exception_ptr exception) {
if (exception) {
- error = [NSError errorWithDomain:MGLErrorDomain code:-1 userInfo:@{
+ error = [NSError errorWithDomain:MGLErrorDomain code:9 userInfo:@{
NSLocalizedDescriptionKey: @(mbgl::util::toString(exception).c_str()),
}];
}
@@ -483,7 +483,7 @@ const MGLExceptionName MGLUnsupportedRegionTypeException = @"MGLUnsupportedRegio
NSError *error;
NSMutableArray *packs;
if (!result) {
- error = [NSError errorWithDomain:MGLErrorDomain code:-1 userInfo:@{
+ error = [NSError errorWithDomain:MGLErrorDomain code:9 userInfo:@{
NSLocalizedDescriptionKey: @(mbgl::util::toString(result.error()).c_str()),
}];
} else {
@@ -513,7 +513,7 @@ const MGLExceptionName MGLUnsupportedRegionTypeException = @"MGLUnsupportedRegio
_mbglFileSource->setMaximumAmbientCacheSize(cacheSize, [&, completion](std::exception_ptr exception) {
NSError *error;
if (exception) {
- error = [NSError errorWithDomain:MGLErrorDomain code:-1 userInfo:@{
+ error = [NSError errorWithDomain:MGLErrorDomain code:9 userInfo:@{
NSLocalizedDescriptionKey: @(mbgl::util::toString(exception).c_str()),
}];
}
@@ -530,7 +530,7 @@ const MGLExceptionName MGLUnsupportedRegionTypeException = @"MGLUnsupportedRegio
NSError *error;
if (exception) {
// Convert std::exception_ptr to an NSError.
- error = [NSError errorWithDomain:MGLErrorDomain code:-1 userInfo:@{
+ error = [NSError errorWithDomain:MGLErrorDomain code:9 userInfo:@{
NSLocalizedDescriptionKey: @(mbgl::util::toString(exception).c_str()),
}];
}
@@ -546,7 +546,7 @@ const MGLExceptionName MGLUnsupportedRegionTypeException = @"MGLUnsupportedRegio
_mbglFileSource->clearAmbientCache([&, completion](std::exception_ptr exception){
NSError *error;
if (exception) {
- error = [NSError errorWithDomain:MGLErrorDomain code:-1 userInfo:@{
+ error = [NSError errorWithDomain:MGLErrorDomain code:9 userInfo:@{
NSLocalizedDescriptionKey: @(mbgl::util::toString(exception).c_str()),
}];
}
diff --git a/platform/darwin/src/MGLTypes.h b/platform/darwin/src/MGLTypes.h
index 491e24310f..7e95847e66 100644
--- a/platform/darwin/src/MGLTypes.h
+++ b/platform/darwin/src/MGLTypes.h
@@ -53,7 +53,9 @@ typedef NS_ENUM(NSInteger, MGLErrorCode) {
/** Source is in use and cannot be removed */
MGLErrorCodeSourceIsInUseCannotRemove = 7,
/** Source is in use and cannot be removed */
- MGLErrorCodeSourceIdentifierMismatch = 8
+ MGLErrorCodeSourceIdentifierMismatch = 8,
+ /** An error occurred while accessing or modifying the offline database */
+ MGLErrorCodeOfflineDatabase = 9
};
/** Options for enabling debugging features in an `MGLMapView` instance. */