Skip to content
This repository has been archived by the owner on May 10, 2019. It is now read-only.

Commit

Permalink
(loadgen) improve error output for failures - issue #681
Browse files Browse the repository at this point in the history
  • Loading branch information
lloyd committed Dec 2, 2011
1 parent d2151f9 commit 263d909
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/load_gen/common.js
Expand Up @@ -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();
Expand Down Expand Up @@ -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());
}
Expand Down

0 comments on commit 263d909

Please sign in to comment.