Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better exception handling and logging #17

Open
j3soon opened this issue Nov 29, 2023 · 2 comments
Open

Better exception handling and logging #17

j3soon opened this issue Nov 29, 2023 · 2 comments

Comments

@j3soon
Copy link
Owner

j3soon commented Nov 29, 2023

As mentioned in the offline reported by @ijsun, the current keyboard will fail silently after using it for a while.

When encountered this issue, a simple Clear All to close all apps can reliably fix the issue by resetting the keyboard. Unfortunately, the steps to reproduce this issue is remained unknown. (not sure if it's due to unreliable internet connection)

This kind of nondeterministic silent failure is difficult to debug. Therefore, we should somehow add a logging mechanism that can report all kinds of silent exceptions and maybe save it in a second page of the keyboard settings app, allowing the user to go through it for debugging purposes. (It's better to allow debugging directly on user's phone without the need of using adb or other external PC tools)

Potentially related:

2023/12/02 Update: Clearing the cache in the app settings page can also fix the issue by resetting the keyboard.

Repository owner deleted a comment from ijsun Nov 29, 2023
@j3soon
Copy link
Owner Author

j3soon commented Dec 6, 2023

Without thinking too much, I guess this issue may be related to the Exception thrown here:

if (!response.isSuccessful || response.code / 100 != 2) {
throw Exception(response.body!!.string().replace('\n', ' '))
}

The exception may cause the onStartTranscription to fail and make the WhisperInputService requiring a reset to work again:

private fun onStartTranscription() {
recorderManager.stop()
whisperJobManager.startAsync(
this,
recordedAudioFilename,
AUDIO_MEDIA_TYPE,
{ transcriptionCallback(it) },
{ transcriptionExceptionCallback(it) }
)
}

A potential solution is to not throw an exception, but display a Toast message instead. This is just my random guess though...

Another observation by @ijsun is that the amplitude feature still works when the issue occurs.

@j3soon
Copy link
Owner Author

j3soon commented Sep 18, 2024

Quick note:

Displaying exceptions with toast messages are available after #23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant