js: Throw GObject.NotImplementedError when requiring overriding

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/merge_requests/549
This commit is contained in:
Marco Trevisan (Treviño)
2019-05-21 15:28:07 -05:00
parent 4730b7a094
commit 88697add1b
5 changed files with 8 additions and 7 deletions

View File

@@ -835,7 +835,7 @@ var LayoutStrategy = class {
// (optionally) for each row in @layout.rows. This method is
// intended to be called by subclasses.
_computeRowSizes(layout) {
throw new Error('_computeRowSizes not implemented');
throw new GObject.NotImplementedError(`_computeRowSizes in ${this.constructor.name}`);
}
// Compute strategy-specific window slots for each window in
@@ -848,7 +848,7 @@ var LayoutStrategy = class {
// * gridHeight - The totial height used by the grid, unscaled, unspaced.
// * rows - A list of rows, which should be instantiated by _newRow.
computeLayout(windows, layout) {
throw new Error('computeLayout not implemented');
throw new GObject.NotImplementedError(`computeLayout in ${this.constructor.name}`);
}
// Given @layout, compute the overall scale and space of the layout.