Skip to content

Conversation

@cowo78
Copy link
Collaborator

@cowo78 cowo78 commented Dec 20, 2016

Exceptions are now simple CanError subclasses and do not depend on ctypes to decode error codes. Decoding is now done in canlib.
Not related to IXXAT but interface.Bus.__new__ was not updating can.rc from its kwargs interface and bitrate.
Apply to the develop branch.

@hardbyte hardbyte self-requested a review December 20, 2016 21:37
Copy link
Owner

@hardbyte hardbyte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks looks good. Only minor suggestions really.

There are a few inconsistencies with the docstrings, can you use triple double quotes """ and add a few annotations e.g. in bus.py.

""" Format a VCI error and attach failed function, decoded HRESULT and arguments
@TODO: make sure we don't generate another exception
"""
buf = ctypes.create_string_buffer(VCI_MAX_ERRSTRLEN)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid repeating the same code just call __vciFormatError here and add the arguments to the returned string.

return None
else:
raise e
raise e
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless you want to add some logging in the event of a VCIError you don't need to catch and re-raise this.

@hardbyte hardbyte merged commit 8b89d28 into hardbyte:develop Dec 31, 2016
@hardbyte
Copy link
Owner

Thanks Giuseppe

hardbyte pushed a commit that referenced this pull request Dec 31, 2016
* Added minimal configuration file example and parameters description * Added support for time.perf_counter in python3. * Better error messages when hardware cannot be initialized * Leave the IXXATBus name when importing * Use time.perf_counter only on python releases >= 3.3 * Handle VCI_E_RXQUEUE_EMPTY with explicit VCIRxQueueEmptyError exception. Added two (private) functions to decode error codes * Module does not depend on ctypes to decode error codes anymore (decoding done in canlib). * Added VCIRxQueueEmptyError exception * Improved docstrings * Ignore utf8 decoding error when formatting vci messages Not specific to IXXAT: * Update can.rc from Bus.__new__ kwargs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants