Some of the methods in the full API, at this moment, are correctly testing whether the underlying C library returned a value != OK and are then raising an exception. All good there, but after that, if the exception didn't happen, then the method should (almost always) return OK. These include:
gp_InitGraph()
gp_CopyGraph()
gp_Read()
gp_Write()
gp_EnsureEdgeCapacity()
- All the ExtendWith methods
Other of the methods do already do this.
Also, the reason I said "almost always" is that there is one more method that requires a little more work than just returning OK, and that is gp_AddEdge(). This is because it has two possible return values other than NOTOK, one is OK and the other is now called AT_EDGE_CAPACITY_LIMIT. So, you'll need to
- capture the return result from the C layer
- throw the exception if the result is not equal to OK and also not equal to
AT_EDGE_CAPACITY_LIMIT
- if the exception wasn't thrown, then return the result (rather than just always returning OK)
Some of the methods in the full API, at this moment, are correctly testing whether the underlying C library returned a value != OK and are then raising an exception. All good there, but after that, if the exception didn't happen, then the method should (almost always) return OK. These include:
gp_InitGraph()gp_CopyGraph()gp_Read()gp_Write()gp_EnsureEdgeCapacity()Other of the methods do already do this.
Also, the reason I said "almost always" is that there is one more method that requires a little more work than just returning
OK, and that isgp_AddEdge(). This is because it has two possible return values other thanNOTOK, one isOKand the other is now calledAT_EDGE_CAPACITY_LIMIT. So, you'll need toAT_EDGE_CAPACITY_LIMIT