From 798b3b3e0ea9b051a2376b4c897b222bf1710c48 Mon Sep 17 00:00:00 2001 From: Devin Weaver Date: Fri, 20 Apr 2018 14:42:15 -0400 Subject: [PATCH] Capture exceptions from I2CFactory Fixes issue #211 --- .../src/com/dexterind/gopigo/components/Board.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Software/Java/src/com/dexterind/gopigo/components/Board.java b/Software/Java/src/com/dexterind/gopigo/components/Board.java index 67f3a283..3c07eafd 100644 --- a/Software/Java/src/com/dexterind/gopigo/components/Board.java +++ b/Software/Java/src/com/dexterind/gopigo/components/Board.java @@ -88,7 +88,14 @@ public Board() throws IOException, InterruptedException { busId = I2CBus.BUS_1; } - final I2CBus bus = I2CFactory.getInstance(busId); + I2CBus bus = null; + + try { + bus = I2CFactory.getInstance(busId); + } catch (Exception e) { + throw new IOException(e.getMessage()); + } + device = bus.getDevice(ADDRESS); } @@ -332,4 +339,4 @@ public int[] readStatus() throws IOException { return status_reg; } -} \ No newline at end of file +}