diff --git a/lib/load_gen/common.js b/lib/load_gen/common.js index cd31954fb5ec5d3fe24e5eeedf18ac8a385a8b73..a02e599ea4bb8355863cdaaa3c4119ba0e543510 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()); }