Skip to content

Commit fed6a02

Browse files
authored
Merge pull request #300 from sukima/bug/missing-try-catch
Capture exceptions from I2CFactory
2 parents 47dba08 + 798b3b3 commit fed6a02

File tree

1 file changed

+9
-2
lines changed
  • Software/Java/src/com/dexterind/gopigo/components

1 file changed

+9
-2
lines changed

Software/Java/src/com/dexterind/gopigo/components/Board.java

+9-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,14 @@ public Board() throws IOException, InterruptedException {
8888
busId = I2CBus.BUS_1;
8989
}
9090

91-
final I2CBus bus = I2CFactory.getInstance(busId);
91+
I2CBus bus = null;
92+
93+
try {
94+
bus = I2CFactory.getInstance(busId);
95+
} catch (Exception e) {
96+
throw new IOException(e.getMessage());
97+
}
98+
9299
device = bus.getDevice(ADDRESS);
93100
}
94101

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

333340
return status_reg;
334341
}
335-
}
342+
}

0 commit comments

Comments
 (0)