Skip to content

Commit

Permalink
Merge pull request #300 from sukima/bug/missing-try-catch
Browse files Browse the repository at this point in the history
Capture exceptions from I2CFactory
  • Loading branch information
CleoQc authored Apr 3, 2019
2 parents 47dba08 + 798b3b3 commit fed6a02
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 fed6a02

Please sign in to comment.