@@ -43,6 +43,7 @@ import kotlin.coroutines.cancellation.CancellationException
4343
4444class MapMarkerBuilder (
4545 val context : ThemedReactContext ,
46+ private val mapErrorHandler : MapErrorHandler ,
4647 private val scope : CoroutineScope = CoroutineScope (SupervisorJob () + Dispatchers .Default ),
4748) {
4849 private val iconCache =
@@ -121,7 +122,7 @@ class MapMarkerBuilder(
121122 }
122123 }
123124 }.onFailure {
124- mapsLog( " external svg resolve failed" )
125+ mapErrorHandler.report( RNMapErrorCode . MARKER_ICON_BUILD_FAILED , " external svg resolve failed" )
125126 }.getOrNull()
126127 }
127128
@@ -145,7 +146,7 @@ class MapMarkerBuilder(
145146 try {
146147 return Typeface .createFromAsset(assetManager, path)
147148 } catch (_: Throwable ) {
148- mapsLog( " font resolve failed: $path " )
149+ mapErrorHandler.report( RNMapErrorCode . INVALID_ARGUMENT , " font resolve failed: $path " )
149150 }
150151 }
151152
@@ -292,14 +293,14 @@ class MapMarkerBuilder(
292293 onReady(desc)
293294 }
294295 } catch (_: OutOfMemoryError ) {
295- mapsLog( " markerId=${m.id} buildIconAsync out of memory" )
296+ mapErrorHandler.report( RNMapErrorCode . MARKER_ICON_BUILD_FAILED , " markerId=${m.id} buildIconAsync out of memory" )
296297 clearIconCache()
297298 withContext(Dispatchers .Main ) {
298299 ensureActive()
299300 onReady(createFallbackDescriptor())
300301 }
301302 } catch (_: Throwable ) {
302- mapsLog( " markerId=${m.id} buildIconAsync failed" )
303+ mapErrorHandler.report( RNMapErrorCode . MARKER_ICON_BUILD_FAILED , " markerId=${m.id} buildIconAsync failed" )
303304 withContext(Dispatchers .Main ) {
304305 ensureActive()
305306 onReady(createFallbackDescriptor())
@@ -343,7 +344,7 @@ class MapMarkerBuilder(
343344 .toInt()
344345
345346 if (wPx <= 0 || hPx <= 0 ) {
346- mapsLog( " markerId=${markerTag.id} invalid svg size" )
347+ mapErrorHandler.report( RNMapErrorCode . INVALID_ARGUMENT , " markerId=${markerTag.id} invalid svg size" )
347348 return ImageView (context)
348349 }
349350
@@ -365,7 +366,7 @@ class MapMarkerBuilder(
365366 val drawable = PictureDrawable (svg.renderToPicture())
366367 svgView.setImageDrawable(drawable)
367368 } catch (_: Exception ) {
368- mapsLog( " markerId=${markerTag.id} infoWindow: svg render failed" )
369+ mapErrorHandler.report( RNMapErrorCode . MARKER_ICON_BUILD_FAILED , " markerId=${markerTag.id} infoWindow: svg render failed" )
369370 return ImageView (context)
370371 }
371372
@@ -403,7 +404,7 @@ class MapMarkerBuilder(
403404 .toInt()
404405
405406 if (wPx <= 0 || hPx <= 0 ) {
406- mapsLog( " markerId=$markerId invalid svg size" )
407+ mapErrorHandler.report( RNMapErrorCode . INVALID_ARGUMENT , " markerId=$markerId invalid svg size" )
407408 return RenderBitmapResult (createFallbackBitmap(), true )
408409 }
409410
@@ -416,10 +417,10 @@ class MapMarkerBuilder(
416417 documentHeight = hPx.toFloat()
417418 }
418419 } catch (_: SVGParseException ) {
419- mapsLog( " markerId=$markerId icon: svg parse failed" )
420+ mapErrorHandler.report( RNMapErrorCode . INVALID_ARGUMENT , " markerId=$markerId icon: svg parse failed" )
420421 return RenderBitmapResult (createFallbackBitmap(), true )
421422 } catch (_: IllegalArgumentException ) {
422- mapsLog( " markerId=$markerId icon: svg invalid" )
423+ mapErrorHandler.report( RNMapErrorCode . INVALID_ARGUMENT , " markerId=$markerId icon: svg invalid" )
423424 return RenderBitmapResult (createFallbackBitmap(), true )
424425 }
425426
0 commit comments