Skip to content

Commit

Permalink
Remove more questionable catches of Throwable
Browse files Browse the repository at this point in the history
  • Loading branch information
mikera committed Aug 28, 2024
1 parent e0af126 commit af3fc4e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
8 changes: 3 additions & 5 deletions convex-cli/src/test/java/convex/cli/key/KeyExportTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import convex.core.crypto.PFXTools;
import convex.core.data.AccountKey;
import convex.core.util.FileUtils;
import convex.core.util.Utils;

public class KeyExportTest {
private static final char[] KEYSTORE_PASSWORD = "testPassword".toCharArray();
Expand All @@ -31,10 +30,9 @@ public class KeyExportTest {
TEMP_FILE=Helpers.createTempFile("tempKeystore", ".pfx");
PFXTools.createStore(TEMP_FILE, KEYSTORE_PASSWORD);
KEYSTORE_FILENAME = TEMP_FILE.getCanonicalPath();
} catch (Throwable t) {
throw Utils.sneakyThrow(t);
}

} catch (Exception t) {
throw new Error(t);
}
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ protected String doInBackground() {
running=repeatCheckBox.isSelected();
if (running) Thread.sleep(((Integer)(repeatTimeSpinner.getValue()))*1000);
};
} catch (Throwable e) {
} catch (Exception e) {
log.warn("Stress test worker terminated unexpectedly",e);
resultArea.setText("Test Error: "+e);
} finally {
Expand Down
2 changes: 1 addition & 1 deletion convex-java/src/test/java/example/trader/Trader.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public static void main(String [] args) {
InputStream is=classLoader.getResourceAsStream("example/trader/APIKEY");
String text = new String(is.readAllBytes());
System.out.println("Using API key: "+text);
} catch (Throwable e) {
} catch (Exception e) {
e.printStackTrace();
throw new Error(e);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ public void run() {
try {
loop();
} catch (InterruptedException e) {
Thread.currentThread().interrupt(); // maintain interrupt status
log.debug("Component thread interrupted: {}",thread);
break;
} catch (Throwable e) {
} catch (Exception e) {
log.warn("Unexpected exception in "+this.getClass().getSimpleName(),e);
// Stop observer ??
// break;
Expand Down

0 comments on commit af3fc4e

Please sign in to comment.