Skip to content

Commit c3ea733

Browse files
committed
throw exception on missing parameters
1 parent ee4695b commit c3ea733

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

android/src/main/kotlin/com/twilio/twilio_voice/service/TVConnectionService.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -481,13 +481,13 @@ class TVConnectionService : ConnectionService() {
481481
val extras = request?.extras
482482
val myBundle: Bundle = extras?.getBundle(TelecomManager.EXTRA_INCOMING_CALL_EXTRAS) ?: run {
483483
Log.e(TAG, "onCreateIncomingConnection: request is missing Bundle EXTRA_INCOMING_CALL_EXTRAS")
484-
return super.onCreateIncomingConnection(connectionManagerPhoneAccount, request)
484+
throw Exception("onCreateIncomingConnection: request is missing Bundle EXTRA_INCOMING_CALL_EXTRAS");
485485
}
486486

487487
myBundle.classLoader = CallInvite::class.java.classLoader
488488
val ci: CallInvite = myBundle.getParcelableSafe(EXTRA_INCOMING_CALL_INVITE) ?: run {
489489
Log.e(TAG, "onCreateIncomingConnection: request is missing CallInvite EXTRA_INCOMING_CALL_INVITE")
490-
return super.onCreateIncomingConnection(connectionManagerPhoneAccount, request)
490+
throw Exception("onCreateIncomingConnection: request is missing CallInvite EXTRA_INCOMING_CALL_INVITE");
491491
}
492492

493493
// Create storage instance for call parameters
@@ -524,21 +524,21 @@ class TVConnectionService : ConnectionService() {
524524
val extras = request?.extras
525525
val myBundle: Bundle = extras?.getBundle(EXTRA_OUTGOING_PARAMS) ?: run {
526526
Log.e(TAG, "onCreateOutgoingConnection: request is missing Bundle EXTRA_OUTGOING_PARAMS")
527-
return super.onCreateOutgoingConnection(connectionManagerPhoneAccount, request)
527+
throw Exception("onCreateOutgoingConnection: request is missing Bundle EXTRA_OUTGOING_PARAMS");
528528
}
529529

530530
// check required EXTRA_TOKEN, EXTRA_TO, EXTRA_FROM
531531
val token: String = myBundle.getString(EXTRA_TOKEN) ?: run {
532532
Log.e(TAG, "onCreateOutgoingConnection: ACTION_PLACE_OUTGOING_CALL is missing String EXTRA_TOKEN")
533-
return super.onCreateOutgoingConnection(connectionManagerPhoneAccount, request)
533+
throw Exception("onCreateOutgoingConnection: ACTION_PLACE_OUTGOING_CALL is missing String EXTRA_TOKEN");
534534
}
535535
val to = myBundle.getString(EXTRA_TO) ?: run {
536536
Log.e(TAG, "onCreateOutgoingConnection: ACTION_PLACE_OUTGOING_CALL is missing String EXTRA_TO")
537-
return super.onCreateOutgoingConnection(connectionManagerPhoneAccount, request)
537+
throw Exception("onCreateOutgoingConnection: ACTION_PLACE_OUTGOING_CALL is missing String EXTRA_TO");
538538
}
539539
val from = myBundle.getString(EXTRA_FROM) ?: run {
540540
Log.e(TAG, "onCreateOutgoingConnection: ACTION_PLACE_OUTGOING_CALL is missing String EXTRA_FROM")
541-
return super.onCreateOutgoingConnection(connectionManagerPhoneAccount, request)
541+
throw Exception("onCreateOutgoingConnection: ACTION_PLACE_OUTGOING_CALL is missing String EXTRA_FROM");
542542
}
543543

544544
// Get all params from bundle

0 commit comments

Comments
 (0)