Skip to content

Commit af3fc4e

Browse files
committed
Remove more questionable catches of Throwable
1 parent e0af126 commit af3fc4e

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

convex-cli/src/test/java/convex/cli/key/KeyExportTest.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import convex.core.crypto.PFXTools;
1818
import convex.core.data.AccountKey;
1919
import convex.core.util.FileUtils;
20-
import convex.core.util.Utils;
2120

2221
public class KeyExportTest {
2322
private static final char[] KEYSTORE_PASSWORD = "testPassword".toCharArray();
@@ -31,10 +30,9 @@ public class KeyExportTest {
3130
TEMP_FILE=Helpers.createTempFile("tempKeystore", ".pfx");
3231
PFXTools.createStore(TEMP_FILE, KEYSTORE_PASSWORD);
3332
KEYSTORE_FILENAME = TEMP_FILE.getCanonicalPath();
34-
} catch (Throwable t) {
35-
throw Utils.sneakyThrow(t);
36-
}
37-
33+
} catch (Exception t) {
34+
throw new Error(t);
35+
}
3836
}
3937

4038
@Test

convex-gui/src/main/java/convex/gui/server/StressPanel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ protected String doInBackground() {
214214
running=repeatCheckBox.isSelected();
215215
if (running) Thread.sleep(((Integer)(repeatTimeSpinner.getValue()))*1000);
216216
};
217-
} catch (Throwable e) {
217+
} catch (Exception e) {
218218
log.warn("Stress test worker terminated unexpectedly",e);
219219
resultArea.setText("Test Error: "+e);
220220
} finally {

convex-java/src/test/java/example/trader/Trader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public static void main(String [] args) {
1111
InputStream is=classLoader.getResourceAsStream("example/trader/APIKEY");
1212
String text = new String(is.readAllBytes());
1313
System.out.println("Using API key: "+text);
14-
} catch (Throwable e) {
14+
} catch (Exception e) {
1515
e.printStackTrace();
1616
throw new Error(e);
1717

convex-observer/src/main/java/convex/observer/AObserverQueue.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,10 @@ public void run() {
5757
try {
5858
loop();
5959
} catch (InterruptedException e) {
60+
Thread.currentThread().interrupt(); // maintain interrupt status
6061
log.debug("Component thread interrupted: {}",thread);
6162
break;
62-
} catch (Throwable e) {
63+
} catch (Exception e) {
6364
log.warn("Unexpected exception in "+this.getClass().getSimpleName(),e);
6465
// Stop observer ??
6566
// break;

0 commit comments

Comments
 (0)