Skip to content

Commit

Permalink
improve stacktrace
Browse files Browse the repository at this point in the history
  • Loading branch information
newhinton committed Jul 7, 2024
1 parent e366c23 commit 3eca118
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class ScanService: Service(), ScannerCallback {
LocalBroadcastManager.getInstance(context).sendBroadcast(resultIntent)
}
} catch (e: Exception) {
showErrorNotification(e.message.toString())
showErrorNotification(e)
val resultIntent = Intent(SCAN_ABORTED)
LocalBroadcastManager.getInstance(context).sendBroadcast(resultIntent)
}
Expand Down Expand Up @@ -168,17 +168,17 @@ class ScanService: Service(), ScannerCallback {
}

//Todo: Migrate this out into its own class
private fun showErrorNotification(bigmessage: String) {
private fun showErrorNotification(exception: Exception) {
val error = NotificationCompat.Builder(this, ERROR_NOTIFICATION_CHANNEL_ID)
.setContentTitle(getString(R.string.error_notification_title))
.setContentText(getString(R.string.error_notification_channel_message))
.setStyle(NotificationCompat.BigTextStyle().bigText(bigmessage))
.setStyle(NotificationCompat.BigTextStyle().bigText(exception.message.toString()))
.setSmallIcon(R.drawable.round_running_with_errors_24)


val clipboardReciever = object : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
copyToClipboard("Error Message", bigmessage)
copyToClipboard("Error Message", exception.stackTraceToString())
}
}

Expand Down

0 comments on commit 3eca118

Please sign in to comment.