Skip to content

Commit 4bb03f3

Browse files
mateoguzmanafacebook-github-bot
authored andcommitted
Migrate com.facebook.react.bridge.queue.MessageQueueThreadHandler to Kotlin (facebook#49583)
Summary: Migrate com.facebook.react.bridge.queue.MessageQueueThreadHandler to Kotlin ## Changelog: [INTERNAL] - Migrate com.facebook.react.bridge.queue.MessageQueueThreadHandler to Kotlin Pull Request resolved: facebook#49583 Test Plan: ```bash yarn test-android yarn android ``` Reviewed By: javache Differential Revision: D69950075 Pulled By: arushikesarwani94 fbshipit-source-id: ddca07860a57816b2ff3b2b8902151686700f5c2
1 parent 07d9cf3 commit 4bb03f3

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
package com.facebook.react.bridge.queue
9+
10+
import android.os.Handler
11+
import android.os.Looper
12+
import android.os.Message
13+
14+
/** Handler that can catch and dispatch Exceptions to an Exception handler. */
15+
public class MessageQueueThreadHandler
16+
constructor(looper: Looper, private val exceptionHandler: QueueThreadExceptionHandler) :
17+
Handler(looper) {
18+
override fun dispatchMessage(msg: Message) {
19+
try {
20+
super.dispatchMessage(msg)
21+
} catch (e: Exception) {
22+
exceptionHandler.handleException(e)
23+
}
24+
}
25+
}

0 commit comments

Comments
 (0)