Improve notification of "decryption failed exception"
Firstly, this error was triggered by myself corrupting one of the files whilst doing something, so the corruption itself is not the issue.
The issue here is that if this was indeed caused by the corruption of a single file within the notes app, the app now does not function at all. Maybe the file should show with ("decryption failed") or something?
I think this is because the exception "DecryptionFailedException " is being thrown by the encryption library, and notes is not catching that exception. (Either that or the encryption library itself is doing this and there's nothing the app can do).
It would be possible to catch the exception DecryptionFailedException in notesservice.php and then do something with it. I can see how this might encourage users to ignore what might potentially be a very serious problem, but personally I think perhaps having the app working with errors might be better than having it fail completely.
Maybe one could catch an exception wherever the service tries to access a file, ie: Line268:
private function getFileById ($folder, $id) {
$file = $folder->getById($id);
And / Or optionally return different error codes to the front end so that the interface can differentiate between "not found", "decryption failed", etc?
Thanks for your analysis, @KimTheFirst !
Providing an error message to the frontend would be the best (see https://github.com/nextcloud/notes/pull/184#issuecomment-380893531 for some ideas on how to present error messages), but I think it's fine to start with catching the Exceptions and writing something meaningful to the log. Could you help us with implementing this, @KimTheFirst ? A pull-request is very appreciated :-)
Copying over my comment from https://github.com/nextcloud/notes/pull/188#issuecomment-387909164 :)
can you adjust the style so it is not a modal, but an emptycontent view? Like in Files when you have an empty folder, with a nice icon (icon-edit), a h2 (»Error loading note«) and a short error description.
The main purpose of this issue was fixed in #188 which is already part of v2.4.0.
In #254, I changed the modal dialog to an OC.Notification which will be part of v2.4.2. This is not exactly what @jancborchardt intended. So this can still be further improved. But since the main issue is fixed, I would like to close this issue. Are you fine with this, @jancborchardt ? (you could open a new one for further design aspects)