better logging in failure scenarios

Signed-off-by: Travis Glenn Hansen <travisghansen@yahoo.com>
This commit is contained in:
Travis Glenn Hansen 2022-04-06 15:38:44 -06:00
parent ed4a065b6b
commit ae96215177
2 changed files with 8 additions and 5 deletions

View File

@ -194,6 +194,9 @@ async function requestHandlerProxy(call, callback, serviceMethodName) {
let message;
if (e instanceof Error) {
message = e.toString();
if (e.stack) {
message += ` ${e.stack}`;
}
} else {
message = JSON.stringify(e);
}

View File

@ -26,7 +26,7 @@ class ControllerZfsGenericDriver extends ControllerZfsBaseDriver {
const options = {};
options.executor = new ZfsSshProcessManager(execClient);
options.idempotent = true;
if (
this.options.zfs.hasOwnProperty("cli") &&
this.options.zfs.cli &&
@ -34,13 +34,13 @@ class ControllerZfsGenericDriver extends ControllerZfsBaseDriver {
) {
options.paths = this.options.zfs.cli.paths;
}
options.sudo = _.get(this.options, "zfs.cli.sudoEnabled", false);
if (typeof this.setZetabyteCustomOptions === "function") {
await this.setZetabyteCustomOptions(options);
}
return new Zetabyte(options);
});
}
@ -406,7 +406,7 @@ delete ${iscsiName}
options
);
if (response.code != 0) {
throw new Error(response.stderr);
throw new Error(JSON.stringify(response));
}
driver.ctx.logger.verbose(
"TargetCLI response: " + JSON.stringify(response)