mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-25 14:24:42 +00:00
Clean up exception catching
This commit is contained in:
1 parent
5a78f97fcb
commit
ec53b6d882
26 files changed
+71
-210
No files matched your search
@@ -53,15 +53,12 @@ public class CircuitFarmLogic extends Circuit {
|
||||
IFarmLogic logic;
|
||||
try {
|
||||
logic = logicClass.getConstructor(IFarmHousing.class).newInstance(housing);
|
||||
} catch (Exception ex) {
|
||||
throw new RuntimeException("Failed to instantiate logic of class " + logicClass.getName() + ": " + ex.getMessage());
|
||||
} catch (ReflectiveOperationException ex) {
|
||||
throw new RuntimeException("Failed to instantiate logic of class " + logicClass.getName() + ": " + ex.getMessage(), ex);
|
||||
}
|
||||
|
||||
try {
|
||||
logic.setManual(isManual);
|
||||
} catch (Throwable e) {
|
||||
// uses older version of the API that doesn't implement setManual
|
||||
}
|
||||
logic.setManual(isManual);
|
||||
|
||||
housing.setFarmLogic(FarmDirection.values()[slot], logic);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user