From 263d90914470c494cf1a5c9fab5a7ce062279d83 Mon Sep 17 00:00:00 2001 From: Lloyd Hilaiel Date: Fri, 2 Dec 2011 13:17:23 -0700 Subject: [PATCH] (loadgen) improve error output for failures - issue #681 --- lib/load_gen/common.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/load_gen/common.js b/lib/load_gen/common.js index cd31954fb..a02e599ea 100644 --- a/lib/load_gen/common.js +++ b/lib/load_gen/common.js @@ -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()); }