js: Return error if signature has no fingerprint

--

* src/Signature.js/get fingerprint: A signature with no fingerprint
  should not happen, but if it does, we should throw an error here,
  as the method is a getter.
This commit is contained in:
Maximilian Krambach 2018-08-22 14:49:11 +02:00
parent 59ed27bae1
commit 94a0ed361e

View File

@ -87,9 +87,12 @@ class GPGME_Signature {
constructor (sigObject){
this._rawSigObject = sigObject;
}
/**
* @returns {String} the fingerprint of this signature
*/
get fingerprint (){
if (!this._rawSigObject.fingerprint){
return gpgme_error('SIG_WRONG');
throw gpgme_error('SIG_WRONG');
} else {
return this._rawSigObject.fingerprint;
}