Skip to content
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

MAYA-127095 remove usage of macros leading to fatal exits #3081

Merged
merged 1 commit into from
Jun 27, 2023

Conversation

pierrebai-adsk
Copy link
Collaborator

We should strive to reduce the number of scenarios under which Maya crashes. Instead, when possible, we should report an error to user and abort the operation. MayaUSD has extensive undo/redo capabilities now and code is able to undo partially done operations. Given this, errors should be reported and propagated back.

The macros TF_AXIOM and TF_FATAL_ERROR cause crashes when their conditions are not met, even in release builds. Remove TF_AXIOM and TF_FATAL_ERROR, replacing them with:

  • TF_WARN when the situation was not an error but an unusual situation.
  • TF_VERIFY when it still warrant an error message to the user, for example during error handling.
  • Simple if/else, with an error return value when not a hard error.
  • Simple if when the condition was trivial, like an empty node when iterating over USD nodes.
  • In a few cases, TF_DEV_AXIOM when the condition was really strictly enforced by a class constructor.
  • Entirely removed, when the code was already dealing with the error.
  • C++ exception when the error needs to propagate to caller, in particular in constructors.

@pierrebai-adsk pierrebai-adsk added enhancement New feature or request crash labels May 11, 2023
@seando-adsk seando-adsk added the do-not-merge-yet Development is not finished, PR not ready for merge label Jun 13, 2023
@pierrebai-adsk pierrebai-adsk force-pushed the bailp/MAYA-127095/errors-instead-of-crashes branch from e92d7bb to 3848a47 Compare June 16, 2023 14:32
@pierrebai-adsk pierrebai-adsk force-pushed the bailp/MAYA-127095/errors-instead-of-crashes branch from 3848a47 to eb685fb Compare June 26, 2023 18:30
@pierrebai-adsk pierrebai-adsk removed the do-not-merge-yet Development is not finished, PR not ready for merge label Jun 26, 2023
@pierrebai-adsk pierrebai-adsk added the ready-for-merge Development process is finished, PR is ready for merge label Jun 26, 2023
@neilh-adsk neilh-adsk merged commit 36ebf4e into dev Jun 27, 2023
@neilh-adsk neilh-adsk deleted the bailp/MAYA-127095/errors-instead-of-crashes branch June 27, 2023 13:20
@neilh-adsk neilh-adsk removed the ready-for-merge Development process is finished, PR is ready for merge label Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants