@staticmethod
def _validate_error(new_class, error) ->None:
    """Check if a declared error is properly configured."""
    states = new_class._states
    if not states or error.target_state not in states:
        raise RuntimeError('Could not find target state {} inside {!r}'.
            format(error.target_state, new_class))
