Skip to content

Commit

Permalink
Capture exceptions from I2CFactory
Browse files Browse the repository at this point in the history
Fixes issue #211
  • Loading branch information
sukima committed Apr 20, 2018
1 parent d7fbee9 commit 798b3b3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Software/Java/src/com/dexterind/gopigo/components/Board.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -332,4 +339,4 @@ public int[] readStatus() throws IOException {

return status_reg;
}
}
}

0 comments on commit 798b3b3

Please sign in to comment.