Scripting: catch errors from shell-perf-helper
When calling remote D-Bus methods, handle exceptions, log them and exit, rather than just proceeding as if nothing happened. https://bugzilla.gnome.org/show_bug.cgi?id=732349
This commit is contained in:
parent
f285f2c69f
commit
2fbd8f063e
@ -98,6 +98,28 @@ function _getPerfHelper() {
|
|||||||
return _perfHelper;
|
return _perfHelper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _callRemote(obj, method, ...args) {
|
||||||
|
let cb;
|
||||||
|
let errcb;
|
||||||
|
|
||||||
|
args.push(function(result, excp) {
|
||||||
|
if (excp) {
|
||||||
|
if (errcb)
|
||||||
|
errcb(excp);
|
||||||
|
} else {
|
||||||
|
if (cb)
|
||||||
|
cb();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
method.apply(obj, args);
|
||||||
|
|
||||||
|
return function(callback, error_callback) {
|
||||||
|
cb = callback;
|
||||||
|
errcb = error_callback;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* createTestWindow:
|
* createTestWindow:
|
||||||
* @params: options for window creation.
|
* @params: options for window creation.
|
||||||
@ -119,19 +141,10 @@ function createTestWindow(width, height, params) {
|
|||||||
alpha: false,
|
alpha: false,
|
||||||
maximized: false });
|
maximized: false });
|
||||||
|
|
||||||
let cb;
|
|
||||||
let perfHelper = _getPerfHelper();
|
let perfHelper = _getPerfHelper();
|
||||||
|
return _callRemote(perfHelper, perfHelper.CreateWindowRemote,
|
||||||
perfHelper.CreateWindowRemote(params.width, params.height,
|
params.width, params.height,
|
||||||
params.alpha, params.maximized,
|
params.alpha, params.maximized);
|
||||||
function(result, excp) {
|
|
||||||
if (cb)
|
|
||||||
cb();
|
|
||||||
});
|
|
||||||
|
|
||||||
return function(callback) {
|
|
||||||
cb = callback;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -141,17 +154,8 @@ function createTestWindow(width, height, params) {
|
|||||||
* created with createTestWindow have been mapped and exposed.
|
* created with createTestWindow have been mapped and exposed.
|
||||||
*/
|
*/
|
||||||
function waitTestWindows() {
|
function waitTestWindows() {
|
||||||
let cb;
|
|
||||||
let perfHelper = _getPerfHelper();
|
let perfHelper = _getPerfHelper();
|
||||||
|
return _callRemote(perfHelper, perfHelper.WaitWindowsRemote);
|
||||||
perfHelper.WaitWindowsRemote(function(result, excp) {
|
|
||||||
if (cb)
|
|
||||||
cb();
|
|
||||||
});
|
|
||||||
|
|
||||||
return function(callback) {
|
|
||||||
cb = callback;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -164,17 +168,8 @@ function waitTestWindows() {
|
|||||||
* process because of normal X asynchronicity.
|
* process because of normal X asynchronicity.
|
||||||
*/
|
*/
|
||||||
function destroyTestWindows() {
|
function destroyTestWindows() {
|
||||||
let cb;
|
|
||||||
let perfHelper = _getPerfHelper();
|
let perfHelper = _getPerfHelper();
|
||||||
|
return _callRemote(perfHelper, perfHelper.DestroyWindowsRemote);
|
||||||
perfHelper.DestroyWindowsRemote(function(result, excp) {
|
|
||||||
if (cb)
|
|
||||||
cb();
|
|
||||||
});
|
|
||||||
|
|
||||||
return function(callback) {
|
|
||||||
cb = callback;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -217,6 +212,10 @@ function _step(g, finish, onError) {
|
|||||||
let waitFunction = g.next();
|
let waitFunction = g.next();
|
||||||
waitFunction(function() {
|
waitFunction(function() {
|
||||||
_step(g, finish, onError);
|
_step(g, finish, onError);
|
||||||
|
},
|
||||||
|
function(err) {
|
||||||
|
if (onError)
|
||||||
|
onError(err);
|
||||||
});
|
});
|
||||||
} catch (err if err instanceof StopIteration) {
|
} catch (err if err instanceof StopIteration) {
|
||||||
if (finish)
|
if (finish)
|
||||||
|
Loading…
Reference in New Issue
Block a user