Skip to content
Snippets Groups Projects
Commit 263d9091 authored by Lloyd Hilaiel's avatar Lloyd Hilaiel
Browse files

(loadgen) improve error output for failures - issue #681

parent d2151f9b
No related branches found
No related tags found
No related merge requests found
......@@ -37,7 +37,8 @@ exports.authAndKey = function(cfg, user, ctx, email, cb) {
pubkey: keypair.publicKey.serialize()
}, function(resp) {
try {
if (resp.code !== 200) throw "non-200 status: " + resp.code;
if (resp.code !== 200) throw "non-200 status: " + resp.code +
+ " - " + resp.body;
if (typeof resp.body !== 'string') throw cb("no response body");
userdb.addCertToUserCtx(ctx, email, resp.body);
cb();
......@@ -83,7 +84,8 @@ exports.genAssertionAndVerify = function(cfg, user, ctx, email, audience, cb) {
}, function (r) {
try {
if (r.code !== 200) throw "non-200 status: " + resp.code;
cb(JSON.parse(r.body).status === 'okay' ? undefined : "verification failed");
if (!JSON.parse(r.body).status === 'okay') throw "verification failed with: " + r.reason;
cb(undefined);
} catch(e) {
return cb("can't verify: " + e.toString());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment