Skip to content

Commit

Permalink
Add exception crash local logging
Browse files Browse the repository at this point in the history
  • Loading branch information
rjmangubat23 committed Jan 28, 2021
1 parent f48669c commit 951d4d7
Showing 1 changed file with 21 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,28 @@ class SmartScannerPlugin : Plugin() {
super.handleOnActivityResult(requestCode, resultCode, data)
val savedCall = savedCall ?: return
if (requestCode == REQUEST_OP_SCANNER) {
Timber.d("Plugin post SmartScannerActivity resultCode %d", resultCode)
if (resultCode == Activity.RESULT_OK) {
val returnedResult = data?.getStringExtra(SmartScannerActivity.SCANNER_RESULT)
Timber.d("Plugin post SmartScannerActivity result %s", returnedResult)
try {
val result = JSONObject(returnedResult)
val ret = JSObject()
ret.put(SmartScannerActivity.SCANNER_RESULT, result)
savedCall.success(ret)
} catch (e: JSONException) {
e.printStackTrace()
try {
Timber.d("Plugin post SmartScannerActivity resultCode %d", resultCode)
if (resultCode == Activity.RESULT_OK) {
val returnedResult = data?.getStringExtra(SmartScannerActivity.SCANNER_RESULT)
Timber.d("Plugin post SmartScannerActivity result %s", returnedResult)
try {
val result = JSONObject(returnedResult)
val ret = JSObject()
ret.put(SmartScannerActivity.SCANNER_RESULT, result)
savedCall.success(ret)
} catch (e: JSONException) {
e.printStackTrace()
}
} else if (resultCode == Activity.RESULT_CANCELED) {
Timber.d("Plugin post SmartScannerActivity RESULT CANCELLED")
savedCall.error("Scanning Cancelled.")
} else {
savedCall.error("Scanning Failed.")
}
} else if (resultCode == Activity.RESULT_CANCELED) {
Timber.d("Plugin post SmartScannerActivity RESULT CANCELLED")
savedCall.error("Scanning Cancelled.")
} else {
savedCall.error("Scanning Failed.")
} catch (exception: Exception) {
Timber.e(exception)
exception.printStackTrace()
}
} else {
savedCall.error("Unknown Request Code!")
Expand Down

0 comments on commit 951d4d7

Please sign in to comment.