def set_exception(self, exception, traceback=None):
if not isinstance(exception, BaseException):<EOL><INDENT>raise RuntimeError("<STR_LIT>")<EOL><DEDENT>self._exception = exception<EOL>self._traceback = traceback<EOL>self._event.set()<EOL>self._invoke_callbacks()<EOL>
Sets the exception for this Future in case of errors.

:param exception: (Exception), exception to be threw in case of error.
:param traceback: (Function), function to be called on traceback (optional).