Skip to content

Commit

Permalink
catch error
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Herrlinger committed Oct 1, 2012
1 parent 941c7d9 commit bccb7b5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/keyexchange.cc
Expand Up @@ -141,8 +141,12 @@ class KeyExchange: ObjectWrap
return ThrowException(Exception::TypeError(String::New("Bad argument")));
}

if(DH_size(KeyExchange::dh) <= 0){
return ThrowException(Exception::TypeError(String::New("DH empty. Generate Keypair first.")));
try {
if(DH_size(KeyExchange::dh) <= 0){
return ThrowException(Exception::TypeError(String::New("DH empty. Generate Keypair first.")));
}
} catch(...){
return ThrowException(Exception::TypeError(String::New("Could not check DH Keypair.")));
}

char *far_key = Buffer::Data(far_key_obj);
Expand Down

0 comments on commit bccb7b5

Please sign in to comment.