def _get_task_error(self, task):
        """
        Retrieve error message from the provided task.

        :return: (error, traceback)
        """
        if not task:
            return None, None

        result = task["result"]

        if isinstance(result, dict):
            stderr = result.get("stderr", None)
            error = result.get("error", None)
            traceback = result.get("traceback", None)
            error = error if error else stderr
        else:
            stderr = None
            error = None
            traceback = None

        return error, traceback

        Retrieve error message from the provided task.

        :return: (error, traceback)
        
st2client/st2client/commands/action.py