extract creation of error result intent into method
This commit is contained in:
@@ -305,19 +305,12 @@ public class OpenPgpService extends Service {
|
|||||||
private Intent getDryRunStatusResult(KeyIdResult keyIdResult) {
|
private Intent getDryRunStatusResult(KeyIdResult keyIdResult) {
|
||||||
switch (keyIdResult.getStatus()) {
|
switch (keyIdResult.getStatus()) {
|
||||||
case MISSING: {
|
case MISSING: {
|
||||||
Intent result = new Intent();
|
return createErrorResultIntent(OpenPgpError.OPPORTUNISTIC_MISSING_KEYS,
|
||||||
result.putExtra(OpenPgpApi.RESULT_ERROR,
|
"missing keys in opportunistic mode");
|
||||||
new OpenPgpError(OpenPgpError.OPPORTUNISTIC_MISSING_KEYS, "missing keys in opportunistic mode"));
|
|
||||||
result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
case NO_KEYS:
|
case NO_KEYS:
|
||||||
case NO_KEYS_ERROR: {
|
case NO_KEYS_ERROR: {
|
||||||
Intent result = new Intent();
|
return createErrorResultIntent(OpenPgpError.NO_USER_IDS, "empty recipient list");
|
||||||
result.putExtra(OpenPgpApi.RESULT_ERROR,
|
|
||||||
new OpenPgpError(OpenPgpError.NO_USER_IDS, "empty recipient list"));
|
|
||||||
result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
case DUPLICATE: {
|
case DUPLICATE: {
|
||||||
Intent result = new Intent();
|
Intent result = new Intent();
|
||||||
@@ -796,11 +789,7 @@ public class OpenPgpService extends Service {
|
|||||||
return result;
|
return result;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.d(Constants.TAG, "exception in updateTrustIdKeyImpl", e);
|
Log.d(Constants.TAG, "exception in updateTrustIdKeyImpl", e);
|
||||||
Intent result = new Intent();
|
return createErrorResultIntent(OpenPgpError.GENERIC_ERROR, e.getMessage());
|
||||||
result.putExtra(OpenPgpApi.RESULT_ERROR,
|
|
||||||
new OpenPgpError(OpenPgpError.GENERIC_ERROR, e.getMessage()));
|
|
||||||
result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user