mirror of
https://github.com/QRouland/UTPass.git
synced 2026-01-10 03:26:57 +00:00
Some improvements
This commit is contained in:
30
plugins/Pass/error.h
Normal file
30
plugins/Pass/error.h
Normal file
@@ -0,0 +1,30 @@
|
||||
// error.h
|
||||
#ifndef ERROR_H
|
||||
#define ERROR_H
|
||||
|
||||
extern "C" {
|
||||
#include "rnp/rnp_err.h"
|
||||
}
|
||||
|
||||
enum ErrorCodeShow {
|
||||
UnexceptedError= 1,
|
||||
BadPassphrase,
|
||||
NoKeyFound,
|
||||
DecryptFailed
|
||||
};
|
||||
|
||||
ErrorCodeShow rnpErrorToErrorCodeShow(int rnpErrorCode) {
|
||||
switch (rnpErrorCode) {
|
||||
case RNP_ERROR_BAD_PASSWORD:
|
||||
return BadPassphrase;
|
||||
case RNP_ERROR_KEY_NOT_FOUND:
|
||||
case RNP_ERROR_NO_SUITABLE_KEY:
|
||||
return NoKeyFound;
|
||||
case RNP_ERROR_DECRYPT_FAILED:
|
||||
return DecryptFailed;
|
||||
default:
|
||||
return UnexceptedError;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // ERROR_H
|
||||
Reference in New Issue
Block a user