Преглед на файлове

Removes unnecessary exception handling

- Attempts to fix the below warning shown in the code. Realized there's no need for an exception handling in the first place.
- If you expect to face an exception, handle the specific exception
- TooGenericExceptionCaught
  - This rule reports catch blocks for exceptions that have a type that is too generic. It should be preferred to catch specific exceptions to the case that is currently handled. If the scope of the caught exception is too broad it can lead to unintended exceptions being caught.
Subbramanian Lakshmanan преди 7 години
родител
ревизия
7a5430ab74
променени са 1 файла, в които са добавени 3 реда и са изтрити 7 реда
  1. 3 7
      app/src/main/java/com/sduduzog/slimlauncher/ui/main/MainFragment.kt

+ 3 - 7
app/src/main/java/com/sduduzog/slimlauncher/ui/main/MainFragment.kt

@@ -172,13 +172,9 @@ class MainFragment : Fragment() {
     private fun setEventListeners() {
         clockTextView.setOnClickListener {
             if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
-                try {
-                    val intent = Intent(android.provider.AlarmClock.ACTION_SHOW_ALARMS)
-                    intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
-                    startActivity(intent)
-                } catch (e: Exception) {
-                    Log.e(TAG, e.message)
-                }
+                val intent = Intent(android.provider.AlarmClock.ACTION_SHOW_ALARMS)
+                intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
+                startActivity(intent)
             }
         }
         bottomSheet.setOnClickListener {