Files
shared
tromjaro
gnome
desktop-overlay
live-overlay
etc
skel
.config
.fonts
.local
share
applications
gnome-background-properties
gnome-settings-daemon
gnome-shell
extensions
appfolders-manager@maestroschan.fr
audio-output-switcher@anduchs
desktop-icons@csoriano
donotdisturb@kylecorry31.github.io
nohotcorner@azuri.free.fr
notifications-alert-on-user-menu@hackedbellini.gmail.com
todo.txt@bart.libert.gmail.com
locale
preferences
schemas
third_party
CHANGELOG.md
COPYING
README.md
buttonCellRenderer.js
errors.js
extension.js
formatter.js
jsTextFile.js
markup.js
messageDialog.js
metadata.json
multiButtonDialog.js
prefs.js
prefsCreator.js
scrollablePopupMenu.js
settings.js
settings.json
sharedConstants.js
stylesheet.css
todoMenuItem.js
topBar.js
urlHighlighter.js
utils.js
tweaks-system-menu@extensions.gnome-shell.fifi.org
unite@hardpixel.eu
user-theme@gnome-shell-extensions.gcampax.github.com
volume_scroll@qord.si
application_state
gnome-overrides-migrated
gvfs-metadata
todo.txt
gsettings-data-convert
.mozilla
.face
root
usr
Packages-Desktop
profile.conf
user-repos.conf
README.md
repo_info
2019-07-09 04:57:09 +03:00

85 lines
2.1 KiB
JavaScript

const Lang = imports.lang;
const Gettext = imports.gettext;
const _ = Gettext.domain('todotxt').gettext;
var TodoTxtErrorTypes = {
TODO_TXT_ERROR: 0,
FILE_WRITE_PERMISSION_ERROR: 1,
FILE_WRITE_ERROR: 2
};
var TodoTxtError = new Lang.Class({
Name: 'TodoTxtError',
type: TodoTxtErrorTypes.TODO_TXT_ERROR,
message: '',
_init: function(error, logFunction) {
if (error === undefined) {
error = '';
}
if (typeof logFunction == 'function') {
logFunction(error);
}
this.message = error;
}
});
var FileWritePermissionError = new Lang.Class({
Name: 'FileWritePermissionError',
type: TodoTxtErrorTypes.FILE_WRITE_PERMISSION_ERROR,
Extends: TodoTxtError,
_init: function(filename, logFunction) {
this.parent(_('%(file) cannot be written. Please check its permissions').replace(
'%(file)', filename), logFunction);
}
});
var FileWriteError = new Lang.Class({
Name: 'FileWriteError',
type: TodoTxtErrorTypes.FILE_WRITE_ERROR,
Extends: TodoTxtError,
_init: function(error, filename, logFunction) {
this.parent(_('An error occured while writing to %(file): %(error)').replace(
'%(file)', filename).replace('%(error)', error), logFunction);
}
});
var ConfigurationError = new Lang.Class({
Name: 'ConfigurationError',
Extends: TodoTxtError,
name: 'ConfigurationError'
});
const UndefinedTokenError = new Lang.Class({
Name: 'UndefinedTokenError',
Extends: TodoTxtError,
name: 'UndefinedTokenError'
});
var IoError = new Lang.Class({
Name: 'IoError',
Extends: TodoTxtError,
name: 'IoError'
});
var JsonError = new Lang.Class({
Name: 'JsonError',
Extends: TodoTxtError,
name: 'JsonError'
});
var SettingsTypeError = new Lang.Class({
Name: 'SettingsTypeError',
Extends: TodoTxtError,
name: 'SettingsTypeError',
_init: function(setting, expectedType, value) {
this.parent('Expected value of type ' + expectedType + ', but got ' + typeof value +
' while setting ' + setting);
}
});
/* vi: set expandtab tabstop=4 shiftwidth=4: */