From ec7b920603299f66332df3b324ed481c732b3657 Mon Sep 17 00:00:00 2001 From: Jason Wray Date: Thu, 9 Aug 2018 13:35:28 -0400 Subject: [ios] Standardize exception definitions --- platform/darwin/src/MGLStyle.mm | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'platform/darwin/src/MGLStyle.mm') diff --git a/platform/darwin/src/MGLStyle.mm b/platform/darwin/src/MGLStyle.mm index e0415c02f7..88499cf9bb 100644 --- a/platform/darwin/src/MGLStyle.mm +++ b/platform/darwin/src/MGLStyle.mm @@ -55,6 +55,12 @@ #import "NSImage+MGLAdditions.h" #endif +const MGLExceptionName MGLInvalidStyleURLException = @"MGLInvalidStyleURLException"; +const MGLExceptionName MGLRedundantLayerException = @"MGLRedundantLayerException"; +const MGLExceptionName MGLRedundantLayerIdentifierException = @"MGLRedundantLayerIdentifierException"; +const MGLExceptionName MGLRedundantSourceException = @"MGLRedundantSourceException"; +const MGLExceptionName MGLRedundantSourceIdentifierException = @"MGLRedundantSourceIdentifierException"; + /** Model class for localization changes. */ @@ -210,7 +216,7 @@ static_assert(6 == mbgl::util::default_styles::numOrderedStyles, try { [source addToMapView:self.mapView]; } catch (std::runtime_error & err) { - [NSException raise:@"MGLRedundantSourceIdentifierException" format:@"%s", err.what()]; + [NSException raise:MGLRedundantSourceIdentifierException format:@"%s", err.what()]; } } @@ -313,14 +319,14 @@ static_assert(6 == mbgl::util::default_styles::numOrderedStyles, MGLStyleLayer *sibling = layers.size() ? [self layerFromMBGLLayer:layers.at(0)] : nil; [styleLayer addToStyle:self belowLayer:sibling]; } catch (const std::runtime_error & err) { - [NSException raise:@"MGLRedundantLayerIdentifierException" format:@"%s", err.what()]; + [NSException raise:MGLRedundantLayerIdentifierException format:@"%s", err.what()]; } } else { try { MGLStyleLayer *sibling = [self layerFromMBGLLayer:layers.at(index)]; [styleLayer addToStyle:self belowLayer:sibling]; } catch (std::runtime_error & err) { - [NSException raise:@"MGLRedundantLayerIdentifierException" format:@"%s", err.what()]; + [NSException raise:MGLRedundantLayerIdentifierException format:@"%s", err.what()]; } } } @@ -402,7 +408,7 @@ static_assert(6 == mbgl::util::default_styles::numOrderedStyles, try { [layer addToStyle:self belowLayer:nil]; } catch (std::runtime_error & err) { - [NSException raise:@"MGLRedundantLayerIdentifierException" format:@"%s", err.what()]; + [NSException raise:MGLRedundantLayerIdentifierException format:@"%s", err.what()]; } [self didChangeValueForKey:@"layers"]; } @@ -431,7 +437,7 @@ static_assert(6 == mbgl::util::default_styles::numOrderedStyles, try { [layer addToStyle:self belowLayer:sibling]; } catch (std::runtime_error & err) { - [NSException raise:@"MGLRedundantLayerIdentifierException" format:@"%s", err.what()]; + [NSException raise:MGLRedundantLayerIdentifierException format:@"%s", err.what()]; } [self didChangeValueForKey:@"layers"]; } @@ -473,14 +479,14 @@ static_assert(6 == mbgl::util::default_styles::numOrderedStyles, try { [layer addToStyle:self belowLayer:nil]; } catch (std::runtime_error & err) { - [NSException raise:@"MGLRedundantLayerIdentifierException" format:@"%s", err.what()]; + [NSException raise:MGLRedundantLayerIdentifierException format:@"%s", err.what()]; } } else { MGLStyleLayer *sibling = [self layerFromMBGLLayer:layers.at(index + 1)]; try { [layer addToStyle:self belowLayer:sibling]; } catch (std::runtime_error & err) { - [NSException raise:@"MGLRedundantLayerIdentifierException" format:@"%s", err.what()]; + [NSException raise:MGLRedundantLayerIdentifierException format:@"%s", err.what()]; } } [self didChangeValueForKey:@"layers"]; -- cgit v1.2.1