improved error handling
This commit is contained in:
parent
c63ff35288
commit
598cfaee0e
|
@ -14,7 +14,7 @@ app.controller('NotesSettingsController',
|
|||
|
||||
$document.on('change', '#notesPath', function() {
|
||||
var msg = t('notes', 'Please wait while new settings are applied…');
|
||||
OC.Notification.showTemporary(msg);
|
||||
OC.Notification.show(msg);
|
||||
$scope.settings.put().then(function() {
|
||||
window.location.reload(true);
|
||||
});
|
||||
|
|
|
@ -28,9 +28,9 @@ app.factory('NotesModel', function () {
|
|||
},
|
||||
get: function (id) {
|
||||
if(this.notesIds[id].error) {
|
||||
OC.dialogs.alert(
|
||||
OC.Notification.show(
|
||||
this.notesIds[id].errorMessage,
|
||||
t('notes','An error occurred!')
|
||||
{ type: 'error' }
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
@ -43,6 +43,8 @@ app.factory('NotesModel', function () {
|
|||
note.modified = updated.modified;
|
||||
note.content = updated.content;
|
||||
note.favorite = updated.favorite;
|
||||
note.error = updated.error;
|
||||
note.errorMessage = updated.errorMessage;
|
||||
} else {
|
||||
this.notes.push(updated);
|
||||
this.notesIds[updated.id] = updated;
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -16,7 +16,7 @@ use OCP\IL10N;
|
|||
use OCP\Files\IRootFolder;
|
||||
use OCP\Files\Folder;
|
||||
use OCP\ILogger;
|
||||
use OC\Encryption\Exceptions\DecryptionFailedException;
|
||||
use OCP\Encryption\Exceptions\GenericEncryptionException;
|
||||
use League\Flysystem\FileNotFoundException;
|
||||
use OCA\Notes\Db\Note;
|
||||
use OCA\Notes\Service\SettingsService;
|
||||
|
@ -106,12 +106,12 @@ class NotesService {
|
|||
}
|
||||
|
||||
private function getNote($file, $notesFolder, $tags=[], $onlyMeta=false) {
|
||||
$id=$file->getId();
|
||||
$id = $file->getId();
|
||||
try {
|
||||
$note=Note::fromFile($file, $notesFolder, $tags, $onlyMeta);
|
||||
$note = Note::fromFile($file, $notesFolder, $tags, $onlyMeta);
|
||||
} catch(FileNotFoundException $e){
|
||||
$note = Note::fromException($this->l10n->t('File error').': ('.$file->getName().') '.$e->getMessage(), $file, $notesFolder, array_key_exists($id, $tags) ? $tags[$id] : []);
|
||||
} catch(DecryptionFailedException $e) {
|
||||
} catch(GenericEncryptionException $e) {
|
||||
$note = Note::fromException($this->l10n->t('Encryption Error').': ('.$file->getName().') '.$e->getMessage(), $file, $notesFolder, array_key_exists($id, $tags) ? $tags[$id] : []);
|
||||
} catch(\Exception $e) {
|
||||
$note = Note::fromException($this->l10n->t('Error').': ('.$file->getName().') '.$e->getMessage(), $file, $notesFolder, array_key_exists($id, $tags) ? $tags[$id] : []);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<textarea editor notes-timeout-change="onEdit()" name="editor"></textarea>
|
||||
<div class="note-meta">
|
||||
<textarea editor notes-timeout-change="onEdit()" name="editor" ng-if="note!==false"></textarea>
|
||||
<div class="note-meta" ng-if="note!==false">
|
||||
<span class="note-word-count" ng-if="note.content.length > 0">{{note.content | wordCount}}</span>
|
||||
<span class="note-unsaved" ng-if="note.unsaved" title="<?php p($l->t('The note has unsaved changes.')); ?>"><?php p($l->t('*')); ?></span>
|
||||
<span class="note-error" ng-if="note.error" ng-click="manualSave()" title="<?php p($l->t('Click here to try again')); ?>"><?php p($l->t('Saving failed!')); ?></span>
|
||||
|
|
Loading…
Reference in New Issue