Commit 089f7c0
committed
fix(backup): Improve error handling for word list import
This commit enhances the error handling for the word list import feature.
Previously, importing a word list from a file did not handle potential exceptions, such as file read errors or the inability to open the selected file.
Now, the file import logic is wrapped in a `try-catch` block to gracefully handle any exceptions during the process. Additionally, it uses a `use` block to ensure the `InputStream` is automatically closed. If an error occurs, a "Failed to restore words" message is displayed to the user. A check is also added to show an "Unable to open file" message if the `ContentResolver` fails to provide an `InputStream`.1 parent 796b735 commit 089f7c0
File tree
1 file changed
+10
-4
lines changed- app/src/main/java/com/github/droidworksstudio/mlauncher
1 file changed
+10
-4
lines changedLines changed: 10 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
311 | 311 | | |
312 | 312 | | |
313 | 313 | | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
318 | 324 | | |
319 | 325 | | |
320 | 326 | | |
| |||
0 commit comments