Make sure we only catch specific exceptions instead of catching them all

This commit is contained in:
Alexander Bakker 2018-03-19 18:00:53 +01:00
parent ebf06aca01
commit f1a03638a0
33 changed files with 608 additions and 425 deletions

View file

@ -1,6 +1,5 @@
package me.impy.aegis.ui;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
@ -14,6 +13,7 @@ import java.util.Collections;
import me.dm7.barcodescanner.core.IViewFinder;
import me.dm7.barcodescanner.zxing.ZXingScannerView;
import me.impy.aegis.crypto.KeyInfo;
import me.impy.aegis.crypto.KeyInfoException;
import me.impy.aegis.db.DatabaseEntry;
import me.impy.aegis.helpers.SquareFinderView;
import me.impy.aegis.ui.views.KeyProfile;
@ -64,9 +64,9 @@ public class ScannerActivity extends AegisActivity implements ZXingScannerView.R
Intent resultIntent = new Intent();
resultIntent.putExtra("KeyProfile", profile);
setResult(Activity.RESULT_OK, resultIntent);
setResult(RESULT_OK, resultIntent);
finish();
} catch (Exception e) {
} catch (KeyInfoException e) {
Toast.makeText(this, "An error occurred while trying to parse the QR code contents", Toast.LENGTH_SHORT).show();
}