-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix invalid assert in exporters #3574
Conversation
Assert that the length is greater than one rather than the value itself. This bug was introduced in the commit: 329be06 - "exporters - group by directories in prj root"
/morph export-build |
We might want to avoid a runtime traceback and fail gracefully with an exception + message. mbed-cli should catch any raised exceptions. @theotherjimmy, what do you think? |
Just use NotSupportedException with a human readable reason. |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
Outputmbed Build Number: 79 All exports and builds passed! |
@c1728p9 please update as suggested above |
This assert is meant to catch logic errors, so it shouldn't occur in practice. If you are concerned about it propagating as a possible runtime error that isn't a bug in the code, it should probably just be handled directly - something like changing this:
to this:
That way even if an empty list is returned an exception doesn't occur. What are your thoughts? |
@c1728p9 seems reasonable to me. How about you @sarahmarshy? |
@sarahmarshy @theotherjimmy What do you think about the proposal above? |
@c1728p9 I gave it a 👍 |
To wrap up the assert vs Exception debate, I think this is fine to come in as is. And if we feel strongly about "no asserts in the tools", then we should have another PR that replaces all the existing asserts in the tools with exceptions. |
Assert that the length is greater than one rather than the value itself. This bug was introduced in the commit:
329be06 -
"exporters - group by directories in prj root"