[gnome-shell-extensions] cleanup: Use GObject.NotImplementedError
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell-extensions] cleanup: Use GObject.NotImplementedError
- Date: Fri, 19 Jul 2019 22:25:00 +0000 (UTC)
commit 5b7631898c5ef9057edca390b14d2dccc68df2e9
Author: Florian Müllner <fmuellner gnome org>
Date: Fri Jul 19 20:45:27 2019 +0200
cleanup: Use GObject.NotImplementedError
Since version 1.50.0, gjs defines GObject.NotImplementedError for throwing
errors when a virtual method that requires a subclass implementation is not
defined.
So use this instead of a generic JS Error in such cases.
https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/84
extensions/window-list/extension.js | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/extensions/window-list/extension.js b/extensions/window-list/extension.js
index 690c407..a89a449 100644
--- a/extensions/window-list/extension.js
+++ b/extensions/window-list/extension.js
@@ -251,7 +251,8 @@ class BaseButton {
}
_onClicked(_actor, _button) {
- throw new Error('Not implemented');
+ throw new GObject.NotImplementedError(
+ `_onClicked in ${this.constructor.name}`);
}
_canOpenPopupMenu() {
@@ -265,7 +266,8 @@ class BaseButton {
}
_isFocused() {
- throw new Error('Not implemented');
+ throw new GObject.NotImplementedError(
+ `_isFocused in ${this.constructor.name}`);
}
_updateStyle() {
@@ -276,7 +278,8 @@ class BaseButton {
}
_windowEnteredOrLeftMonitor(_metaDisplay, _monitorIndex, _metaWindow) {
- throw new Error('Not implemented');
+ throw new GObject.NotImplementedError(
+ `_windowEnteredOrLeftMonitor in ${this.constructor.name}`);
}
_isWindowVisible(window) {
@@ -288,7 +291,8 @@ class BaseButton {
}
_updateVisibility() {
- throw new Error('Not implemented');
+ throw new GObject.NotImplementedError(
+ `_updateVisibility in ${this.constructor.name}`);
}
_getIconGeometry() {
@@ -301,7 +305,8 @@ class BaseButton {
}
_updateIconGeometry() {
- throw new Error('Not implemented');
+ throw new GObject.NotImplementedError(
+ `_updateIconGeometry in ${this.constructor.name}`);
}
_onDestroy() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]