Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Li-Jinjie
Copy link
Contributor

Hi acados team,

I recently noticed that the exceptions in the acados Python template are too broad for the issues they represent, which makes it difficult to catch specific errors in higher-level code. Would you like me to replace general Exception usages with more specific exception types?

I’ve made a sample change in utils.py. It's also possible to define several new custom error types for acados, if needed. If you're okay with this direction, I can continue updating the exceptions in the other files as well.

@FreyJo
Copy link
Member

FreyJo commented Mar 25, 2025

Thanks for the PR!
I think it is nice to switch to the more specific error types as you did!
I don't see the need for defining new custom error types for acados though.
I am not sure, if there were some new error types defined in Python lately, but we want to be compatible with Python >=3.8.

@Li-Jinjie
Copy link
Contributor Author

Li-Jinjie commented Apr 3, 2025

@FreyJo Hi FreyJo, I believe I have changed all Exceptions in the python template to a more specific one. Could you please review them?

Copy link
Member

@FreyJo FreyJo left a comment

Choose a reason for hiding this comment

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

Thanks again for the PR! It looks very good.
Unfortunately there are now some conflicts, could you resolve them?
The CI failing is unrelated to the PR, see #1487

@Li-Jinjie
Copy link
Contributor Author

Hi FreyJo, I have resolved all the conflicts, would you like to check them?

@Li-Jinjie Li-Jinjie force-pushed the pr/refactor-py-exception branch from d698bad to 46d31f1 Compare April 4, 2025 06:07
@FreyJo
Copy link
Member

FreyJo commented Apr 4, 2025

It seems there are still errors in the cython wrapper. Unfortunately, and there is also a new conflict. Sorry for the inconvenience.

@Li-Jinjie
Copy link
Contributor Author

I should have fixed the bug and solved the conflict. Could you approve the workflow to check them again?

@FreyJo FreyJo merged commit f135546 into acados:main Apr 6, 2025
14 checks passed
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.

2 participants