Skip to content

Commit e28784d

Browse files
cortinicofacebook-github-bot
authored andcommitted
Remove unnecessary NativeArgumentsParseException (#53408)
Summary: Pull Request resolved: #53408 This class is internal + legacy arch so can safely be removed now. I've replaced the throw/catch site with the superclass of this exception. Changelog: [Internal] [Changed] - Reviewed By: mdvacca Differential Revision: D80710950 fbshipit-source-id: 96615835588ce409de40d31ee83b82c88d3a07a0
1 parent 28275a0 commit e28784d

File tree

3 files changed

+4
-38
lines changed

3 files changed

+4
-38
lines changed

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaMethodWrapper.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ internal class JavaMethodWrapper(
189189
}
190190

191191
if (jsArgumentsNeeded != parameters.size()) {
192-
throw NativeArgumentsParseException(
192+
throw JSApplicationCausedNativeException(
193193
"$traceName got ${parameters.size()} arguments, expected $jsArgumentsNeeded"
194194
)
195195
}
@@ -208,7 +208,7 @@ internal class JavaMethodWrapper(
208208
i++
209209
}
210210
} catch (e: UnexpectedNativeTypeException) {
211-
throw NativeArgumentsParseException(
211+
throw JSApplicationCausedNativeException(
212212
"${e.message} (constructing arguments for $traceName at argument index ${
213213
getAffectedRange(
214214
jsArgumentsConsumed,
@@ -218,7 +218,7 @@ internal class JavaMethodWrapper(
218218
e,
219219
)
220220
} catch (e: NullPointerException) {
221-
throw NativeArgumentsParseException(
221+
throw JSApplicationCausedNativeException(
222222
"${e.message} (constructing arguments for $traceName at argument index ${
223223
getAffectedRange(
224224
jsArgumentsConsumed,

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeArgumentsParseException.kt

Lines changed: 0 additions & 34 deletions
This file was deleted.

packages/react-native/ReactAndroid/src/test/java/com/facebook/react/bridge/BaseJavaModuleTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class BaseJavaModuleTest {
4444
private fun findMethod(mname: String, methods: List<JavaModuleWrapper.MethodDescriptor>): Int =
4545
methods.indexOfFirst({ it.name === mname })
4646

47-
@Test(expected = NativeArgumentsParseException::class)
47+
@Test(expected = JSApplicationCausedNativeException::class)
4848
fun testCallMethodWithoutEnoughArgs() {
4949
val methodId = findMethod("regularMethod", methods)
5050
whenever(arguments.size()).thenReturn(1)

0 commit comments

Comments
 (0)