@@ -121,8 +121,8 @@ class MapMarkerBuilder(
121121 null
122122 }
123123 }
124- }.onFailure {
125- mapErrorHandler.report(RNMapErrorCode .MARKER_ICON_BUILD_FAILED , " external svg resolve failed" )
124+ }.onFailure { t ->
125+ mapErrorHandler.report(RNMapErrorCode .MARKER_ICON_BUILD_FAILED , " external svg resolve failed" , t )
126126 }.getOrNull()
127127 }
128128
@@ -145,8 +145,8 @@ class MapMarkerBuilder(
145145 for (path in candidates) {
146146 try {
147147 return Typeface .createFromAsset(assetManager, path)
148- } catch (_ : Throwable ) {
149- mapErrorHandler.report(RNMapErrorCode .INVALID_ARGUMENT , " font resolve failed: $path " )
148+ } catch (t : Throwable ) {
149+ mapErrorHandler.report(RNMapErrorCode .INVALID_ARGUMENT , " font resolve failed: $path " , t )
150150 }
151151 }
152152
@@ -292,15 +292,20 @@ class MapMarkerBuilder(
292292 ensureActive()
293293 onReady(desc)
294294 }
295- } catch (_ : OutOfMemoryError ) {
296- mapErrorHandler.report(RNMapErrorCode .MARKER_ICON_BUILD_FAILED , " markerId=${m.id} buildIconAsync out of memory" )
295+ } catch (e : OutOfMemoryError ) {
296+ mapErrorHandler.report(RNMapErrorCode .MARKER_ICON_BUILD_FAILED , " markerId=${m.id} buildIconAsync out of memory" , e )
297297 clearIconCache()
298298 withContext(Dispatchers .Main ) {
299299 ensureActive()
300300 onReady(createFallbackDescriptor())
301301 }
302- } catch (_: Throwable ) {
303- mapErrorHandler.report(RNMapErrorCode .MARKER_ICON_BUILD_FAILED , " markerId=${m.id} buildIconAsync failed" )
302+ } catch (_: CancellationException ) {
303+ withContext(Dispatchers .Main ) {
304+ ensureActive()
305+ onReady(createFallbackDescriptor)
306+ }
307+ } catch (t: Throwable ) {
308+ mapErrorHandler.report(RNMapErrorCode .MARKER_ICON_BUILD_FAILED , " markerId=${m.id} buildIconAsync failed" , t)
304309 withContext(Dispatchers .Main ) {
305310 ensureActive()
306311 onReady(createFallbackDescriptor())
@@ -365,8 +370,8 @@ class MapMarkerBuilder(
365370 }
366371 val drawable = PictureDrawable (svg.renderToPicture())
367372 svgView.setImageDrawable(drawable)
368- } catch (_ : Exception ) {
369- mapErrorHandler.report(RNMapErrorCode .MARKER_ICON_BUILD_FAILED , " markerId=${markerTag.id} infoWindow: svg render failed" )
373+ } catch (e : Exception ) {
374+ mapErrorHandler.report(RNMapErrorCode .MARKER_ICON_BUILD_FAILED , " markerId=${markerTag.id} infoWindow: svg render failed" , e )
370375 return ImageView (context)
371376 }
372377
@@ -416,11 +421,11 @@ class MapMarkerBuilder(
416421 documentWidth = wPx.toFloat()
417422 documentHeight = hPx.toFloat()
418423 }
419- } catch (_ : SVGParseException ) {
420- mapErrorHandler.report(RNMapErrorCode .INVALID_ARGUMENT , " markerId=$markerId icon: svg parse failed" )
424+ } catch (e : SVGParseException ) {
425+ mapErrorHandler.report(RNMapErrorCode .INVALID_ARGUMENT , " markerId=$markerId icon: svg parse failed" , e )
421426 return RenderBitmapResult (createFallbackBitmap(), true )
422- } catch (_ : IllegalArgumentException ) {
423- mapErrorHandler.report(RNMapErrorCode .INVALID_ARGUMENT , " markerId=$markerId icon: svg invalid" )
427+ } catch (e : IllegalArgumentException ) {
428+ mapErrorHandler.report(RNMapErrorCode .INVALID_ARGUMENT , " markerId=$markerId icon: svg invalid" , e )
424429 return RenderBitmapResult (createFallbackBitmap(), true )
425430 }
426431
0 commit comments