maplibre-native icon indicating copy to clipboard operation
maplibre-native copied to clipboard

MLNStyle `addSource` throws NSException instead of returning NSError

Open albertmoravec opened this issue 4 months ago • 1 comments

Describe the bug Adding source via MLNStyle.addSource() twice causes MLNRedundantSourceIdentifierException to be thrown. Since this is an Objective-C exception, AFAIK it is impossible to catch it from Swift without additional tooling in ObjC, ultimately causing my Flutter app to crash.

To Reproduce Steps to reproduce the behavior:

  1. Call MLNStyle.addSource() twice for the same source from Swift
  2. NSException is thrown which cannot be handled directly in Swift

Expected behavior NSError should be returned so it can be properly handled.

Platform information (please complete the following information):

  • OS: iOS
  • Platform iOS
  • Version 16.7.4

albertmoravec avatar Oct 15 '24 14:10 albertmoravec