On Wed, Jan 30, 2019, 3:31 AM Kyle Burris <kylebur...@gmail.com> wrote:
> I'm curious if anyone has any general guidelines on how frequently I > should be checking MStatus for a production DG node or Deformer. Should I > run CHECK_MSTATUS_AND_RETURN_IT every time a function can take a MStatus > arg, or is that overkill? Should I only check when getting data out of the > data block? > > I realize this is a bit of a vague question, but I'm just wondering what > your experience with it is. > I will meet your vague question with a vague opinion :) You would use a CHECK_MSTATUS variant as often as you want to know when your call could have failed. As opposed to an exception-based error handling, MStatus is going to be returned/set when a function has defined error conditions. Skipping any of the checks is a good way to end up with undefined behavior and harder to solve bugs. It would be different if it were exception-based and your code could crash at any point, or if you could wrap entire blocks in a try/catch albeit with less context about the site of the error. If you can react to the error then you have the option of checking MFAIL. If the error wouldn't mean you need to stop your operations, then you can use CHECK_MSTATUS just for logging and debugging. Otherwise you have the other two to bail. It may seem verbose to have so much error checking but it's better than your code segfaulting further down, or claiming you have bad types or values. > Thanks > Kyle > > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to python_inside_maya+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/860d8717-81ff-4a9d-bce3-05d1905844ca%40googlegroups.com > <https://groups.google.com/d/msgid/python_inside_maya/860d8717-81ff-4a9d-bce3-05d1905844ca%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2qbM4qn8qZYAEZ_hJThyXFwgbENc2ot5Z1kYFGg7KnCA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.