production errors

This commit is contained in:
smileomi18@gmail.com
2023-09-13 14:40:46 +05:30
parent 19289a5c33
commit e5da37064a

View File

@@ -70,29 +70,30 @@ class KitScanActivity : AppCompatActivity() {
// } // }
if (checkHemoCubeKitData()) { try {
try { if (checkHemoCubeKitData()) {
DataHolder.selectedTest!!.kitSerial = DataHolder.selectedTest!!.kitSerial =
sharedPreference.getString(Constants.KIT_NUMBER, "").toString() sharedPreference.getString(Constants.KIT_NUMBER, "").toString()
moveToNext() moveToNext()
} catch (e: NullPointerException) { } else {
// Handle the NullPointerException here // Handle the case when checkHemoCubeKitData() returns false
e.printStackTrace() // You can log the exception for debugging with(sharedPreference.edit()) {
FirebaseCrashlytics.getInstance().recordException(e) putString(Constants.KIT_NUMBER, "")
val errorMessage = "An error occurred: ${e.message}" putInt(Constants.KIT_COUNT, 0)
val rootView = findViewById<View>(android.R.id.content) putString(Constants.BUFFER_VALUE_1, "")
Snackbar.make(rootView, errorMessage, Snackbar.LENGTH_LONG).show() putString(Constants.BUFFER_VALUE_2, "")
// Optionally, show a user-friendly error message to the user apply()
// Toast.makeText(applicationContext, "An error occurred", Toast.LENGTH_SHORT).show() }
}
} else {
with(sharedPreference.edit()) {
putString(Constants.KIT_NUMBER, "")
putInt(Constants.KIT_COUNT, 0)
putString(Constants.BUFFER_VALUE_1, "")
putString(Constants.BUFFER_VALUE_2, "")
apply()
} }
} catch (e: NullPointerException) {
// Handle the NullPointerException here
e.printStackTrace() // You can log the exception for debugging
FirebaseCrashlytics.getInstance().recordException(e)
val errorMessage = "An error occurred: ${e.message}"
val rootView = findViewById<View>(android.R.id.content)
Snackbar.make(rootView, errorMessage, Snackbar.LENGTH_LONG).show()
// Optionally, show a user-friendly error message to the user
// Toast.makeText(applicationContext, "An error occurred", Toast.LENGTH_SHORT).show()
} }