Skip to content

Conversation

@erlend-aasland
Copy link
Contributor

Fixes #475

@codecov-commenter
Copy link

codecov-commenter commented Jul 2, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.68%. Comparing base (5734f37) to head (bb1f9e9).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #476      +/-   ##
==========================================
+ Coverage   67.55%   67.68%   +0.12%     
==========================================
  Files          26       26              
  Lines        3101     3104       +3     
  Branches      521      521              
==========================================
+ Hits         2095     2101       +6     
+ Misses        864      862       -2     
+ Partials      142      141       -1     
Files Coverage Δ
canopen/objectdictionary/__init__.py 82.29% <100.00%> (+1.16%) ⬆️

Copy link
Member

@acolomb acolomb left a comment

Choose a reason for hiding this comment

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

This looks fine overall. But I still favor ValueError in these cases, as it is simply an invalid string being passed for the parameter. Such things should be sanitized / limited before calling the function IMHO. If it comes from a config file, ValueError will be a correct description of th failure cause. In contrast, ObjectDictionaryError concerns invalid operations using the OD, as its docstring states: """Unsupported operation with the current Object Dictionary."""

@erlend-aasland
Copy link
Contributor Author

I'm fine with ValueError; it is a good alternative to ObjectDictionaryError.

@erlend-aasland erlend-aasland marked this pull request as ready for review July 2, 2024 09:40
@erlend-aasland erlend-aasland changed the title Consistently raise ObjectDictionaryError in the import/export OD APIs Raise ValueError and improve the exc message for unknown formats in the import/export OD APIs Jul 2, 2024
@acolomb acolomb changed the title Raise ValueError and improve the exc message for unknown formats in the import/export OD APIs Raise ValueError for unknown formats in the import/export OD APIs Jul 2, 2024
@acolomb acolomb merged commit 503918c into canopen-python:master Jul 2, 2024
@erlend-aasland erlend-aasland deleted the no-NotImplementedError-for-you branch July 2, 2024 10:33
@erlend-aasland
Copy link
Contributor Author

Thanks a lot for the review and the helpful discussion; highly appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider using ObjectDictionaryError iso. NotImplementedError in export/import OD APIs

3 participants