Report exceptions from requests via Exreporter.
512383
def process_exception(self, request, exception):
        
        gc = GithubCredentials(
            user=settings.EXREPORTER_GITHUB_USER,
            repo=settings.EXREPORTER_GITHUB_REPO,
            auth_token=settings.EXREPORTER_GITHUB_AUTH_TOKEN)
        gs = GithubStore(credentials=gc)
        reporter = ExReporter(
            store=gs, labels=settings.EXREPORTER_GITHUB_LABELS)

        reporter.report()
265757
def send_exception(self, code, exc_info=None, headers=None):
        ""
        if headers is None:
            headers = {}

        if not exc_info:
            exc_info = sys.exc_info()

        self.send_error_msg(code,
                            traceback.format_exception(*exc_info),
                            headers)
186497
def install_exception_reporter(report=True):
    

    reporter = Reporter(report=report)
    sys.excepthook = reporter
    return reporter
645754
def report_exception(self, filename, exc):
        
        # Build fake event.
        event = AbinitError(src_file="Unknown", src_line=0, message=str(exc))
        return EventReport(filename, events=[event])
1231441
public void reportServiceException(UniformInterfaceException ex,
    boolean showNotification)
  {
    QueryPanel qp = searchView.getControlPanel().getQueryPanel();

    String caption = null;
    String description = null;

    if(!AnnisBaseUI.handleCommonError(ex, "execute query"))
    {
      switch (ex.getResponse().getStatus())
      {
        case 400:
          List<AqlParseError> errors
            = ex.getResponse().getEntity(
              new GenericType<List<AqlParseError>>()
              {
              });
          caption = "Parsing error";
          description = Joiner.on("\n").join(errors);
          qp.setStatus(description);
          qp.setErrors(errors);
          break;
        case 504:
          caption = "Timeout";
          description = "Query execution took too long.";
          qp.setStatus(caption + ": " + description);
          break;
        case 403:
          if(Helper.getUser() == null)
          {
            // not logged in
            qp.setStatus("You don't have the access rights to query this corpus. "
              + "You might want to login to access more corpora.");
            searchView.getMainToolbar().showLoginWindow(true);
          }
          else
          {
            // logged in but wrong user
            caption = "You don't have the access rights to query this corpus. "
              + "You might want to login as another user to access more corpora.";
            qp.setStatus(caption);
          } break;
        default:
          log.error(
            "Exception when communicating with service", ex);
          qp.setStatus("Unexpected exception:  " + ex.getMessage());
          ExceptionDialog.show(ex,
            "Exception when communicating with service.");
          break;
      }

      if (showNotification && caption != null)
      {
        Notification.show(caption, description, Notification.Type.WARNING_MESSAGE);
      }
    }

  }
1291340
function reportAndThrowError(oMetaModel, sMessage, sDetails) {
		var oError = new Error(sDetails + ": " + sMessage);

		oMetaModel.oModel.reportError(sMessage, sODataMetaModel, oError);
		throw oError;
	}
129544
def report(self, request: 'Request'=None, state: Text=None):
        
        self._make_context(request, state)
        self.client.captureException()
        self._clear_context()
568208
def _check_error(response):
        """"""
        if (not response.ok) or (response.status_code != 200):
            raise Exception(
                response.json()['error'] + ': ' +
                response.json()['error_description']
            )
640541
@ExceptionHandler(Exception.class)
    public ModelAndView handleUnauthorizedServiceException(final HttpServletRequest req, final Exception ex) {
        return WebUtils.produceUnauthorizedErrorView();
    }
640872
def _handle_exception():
    """"""
    # Heavily influenced by logging.Handler.handleError.

    # See note here:
    # https://docs.python.org/3.4/library/sys.html#sys.__stderr__
    if sys.stderr:
        einfo = sys.exc_info()
        try:
            traceback.print_exception(einfo[0], einfo[1], einfo[2],
                                      None, sys.stderr)
        except IOError:
            pass
        finally:
            del einfo
969608
def error_received(self, exception):
        """"""
        if exception is None:
            pass
        else:
            import pprint
            pprint.pprint(exception)
            _LOGGER.error('Error received: %s', exception)
1331633
public static void print_exception(Exception ex) {

        if (ex instanceof DevFailed) {
//
// For a Tango DevFailed exception
//

            DevFailed ex_dev = ((fr.esrf.Tango.DevFailed) ex);
            for (int i = 0; i < ex_dev.errors.length; i++) {
                System.err.println("Tango exception");
                System.err.print("Severity -> ");
                switch (ex_dev.errors[i].severity.value()) {
                    case ErrSeverity._WARN:
                        System.err.println("WARNING ");
                        break;

                    case ErrSeverity._ERR:
                        System.err.println("ERROR ");
                        break;

                    case ErrSeverity._PANIC:
                        System.err.println("PANIC ");
                        break;

                    default:
                        System.err.println("Unknown severity code");
                        break;
                }
                System.err.println("Desc -> " + ex_dev.errors[i].desc);

                //	Check if from a MultiDevFailed exception
                if (ex instanceof NamedDevFailedList) {
                    NamedDevFailedList ndfl = (NamedDevFailedList) ex;
                    if (i < ndfl.get_faulty_attr_nb()) {
                        NamedDevFailed ndf = ndfl.elementAt(i);
                        for (DevError err : ndf.err_stack)
                            System.out.println("Reason -> " + err.reason);
                    }
                } else
                    System.err.println("Reason -> " + ex_dev.errors[i].reason);
                System.err.println("Origin -> " + ex_dev.errors[i].origin);
            }
        } else {
            int last_dot, before_last_dot;
            String ex_name = ex.getClass().getName();
            if ((last_dot = ex_name.lastIndexOf('.')) < 0) {
                // Unknown exception
                System.err.println(ex.getMessage());
                ex.printStackTrace();
                return;
            }
            String ex_last_name = ex_name.substring(last_dot + 1);
            if ((before_last_dot = ex_name.lastIndexOf('.', last_dot - 1)) < 0) {
                // Unknown exception
                System.err.println(ex.getMessage());
                ex.printStackTrace();
                return;
            }

            String ex_part_name = ex_name.substring(before_last_dot + 1, last_dot);
            if (ex_part_name.equals("CORBA")) {
                // CORBA System exception
                SystemException ex_sys = ((SystemException) ex);
                System.err.println("CORBA system exception " + ex_last_name);
                System.err.println(ex.getMessage());
                System.err.print("Completed: ");
                switch (ex_sys.completed.value()) {
                    case CompletionStatus._COMPLETED_YES:
                        System.err.println("yes");
                        break;

                    case CompletionStatus._COMPLETED_NO:
                        System.err.println("no");
                        break;

                    case CompletionStatus._COMPLETED_MAYBE:
                        System.err.println("maybe");
                        break;
                }
                System.err.println("Minor code: " + ex_sys.minor);
            } else {
                // Unknown exeption
                System.err.println(ex.getMessage());
                ex.printStackTrace();
            }

        }
    }

    /**
     * Print a TANGO exception with stack.
     * <p/>
     * Print all the details of a TANGO exception. It also prints the stack when
     * the exception occurs. If the exception is not a TANGO DevFailed exception, it
     * only print the stack.
     *
     * @param ex The exception object reference
     */

    public static void print_exception_stack(Exception ex) {
        print_exception(ex);
        ex.printStackTrace();
    }

    //===============================================================
    /**
     * Returns the current code line (used as origin to throw a DevFailed)
     *
     * @return the current code line (used as origin to throw a DevFailed)
     */
    //===============================================================
    private static String getCurrentCodeLine() {
        //  index 0:    Thread.getTrace()
        //  index 1:    The following line.
        //  index 2:    The throw_exception() line.
        //  index 3:    the calling line.
        return Thread.currentThread().getStackTrace()[3].toString();
    }

    /**
     * Generate and throw a TANGO DevFailed exception.
     * <p/>
     * The exception is created with a single DevError
     * object. The DevError severity field is set to ERR
     * Click <a href="../../tango_basic/idl_html/Tango.html#DevFailed">here</a> to read
     * <b>DevFailed</b> exception specification
     *
     * @param reason The exception DevError object reason field
     * @param desc   The exception DevError object desc field.
     *               origin will be find from java classes.
     * @throws DevFailed The thrown exception.
     *                   Click <a href="../../tango_basic/idl_html/Tango.html#DevFailed">here</a> to read
     *                   <b>DevFailed</b> exception specification
     */
    public static void throw_exception(String reason, String desc) throws DevFailed {
        throw_exception(reason, desc, getCurrentCodeLine());
    }

    /**
     * Generate and throw a TANGO DevFailed exception.
     * <p/>
     * The exception is created with a single DevError
     * object. The DevError severity field is set to ERR
     * Click <a href="../../tango_basic/idl_html/Tango.html#DevFailed">here</a> to read
     * <b>DevFailed</b> exception specification
     *
     * @param reason The exception DevError object reason field
     * @param desc   The exception DevError object desc field
     * @param origin The exception DevError object origin field
     * @throws DevFailed The thrown exception.
     *                   Click <a href="../../tango_basic/idl_html/Tango.html#DevFailed">here</a> to read
     *                   <b>DevFailed</b> exception specification
     */
    public static void throw_exception(String reason, String desc, String origin)
            throws DevFailed {
        throw_exception(reason, desc, origin, ErrSeverity.ERR);
    }

    /**
     * Generate and throw a TANGO DevFailed exception.
     * <p/>
     * The exception is created with a single DevError
     * object.
     * Click <a href="../../tango_basic/idl_html/Tango.html#DevFailed">here</a> to read
     * <b>DevFailed</b> exception specification
     *
     * @param reason The exception DevError object reason field
     * @param desc   The exception DevError object desc field
     * @param origin The exception DevError object origin field
     * @param sever  The exception DevError object severity field
     * @throws DevFailed The thrown exception.
     *                   Click <a href="../../tango_basic/idl_html/Tango.html#DevFailed">here</a> to read
     *                   <b>DevFailed</b> exception specification
     */
    public static void throw_exception(String reason, String desc,
                                       String origin, ErrSeverity sever)
            throws DevFailed {
        DevError[] err = new DevError[1];
        err[0] = new DevError();

        err[0].desc = desc;
        err[0].severity = sever;
        err[0].reason = reason;
        err[0].origin = origin;

        throw new DevFailed(err);
    }

    /**
     * Re-throw a TANGO DevFailed exception with one more error.
     * <p/>
     * The exception is re-thrown with one more DevError
     * object. The new DevError severity field is set to ERR
     * Click <a href="../../tango_basic/idl_html/Tango.html#DevFailed">here</a> to read
     * <b>DevFailed</b> exception specification
     *
     * @param ex     The DevFailed exception
     * @param reason The exception DevError object reason field
     * @param desc   The exception DevError object desc field
     * @throws DevFailed The thrown exception.
     *                   Click <a href="../../tango_basic/idl_html/Tango.html#DevFailed">here</a> to read
     *                   <b>DevFailed</b> exception specification
     */
    public static void re_throw_exception(DevFailed ex, String reason, String desc)
            throws DevFailed {
        re_throw_exception(ex, reason, desc, getCurrentCodeLine());
    }

    /**
     * Re-throw a TANGO DevFailed exception with one more error.
     * <p/>
     * The exception is re-thrown with one more DevError
     * object. The new DevError severity field is set to ERR
     * Click <a href="../../tango_basic/idl_html/Tango.html#DevFailed">here</a> to read
     * <b>DevFailed</b> exception specification
     *
     * @param ex     The DevFailed exception
     * @param reason The exception DevError object reason field
     * @param desc   The exception DevError object desc field
     * @param origin The exception DevError object origin field
     * @throws DevFailed The thrown exception.
     *                   Click <a href="../../tango_basic/idl_html/Tango.html#DevFailed">here</a> to read
     *                   <b>DevFailed</b> exception specification
     */
    public static void re_throw_exception(DevFailed ex,
                                          String reason, String desc, String origin)
            throws DevFailed {
        re_throw_exception(ex, reason, desc, origin, ErrSeverity.ERR);
    }

    /**
     * Re-throw a TANGO DevFailed exception with one more error.
     * <p/>
     * The exception is re-rhrown with one more DevError
     * object.
     * Click <a href="../../tango_basic/idl_html/Tango.html#DevFailed">here</a> to read
     * <b>DevFailed</b> exception specification
     *
     * @param ex     The DevFailed exception
     * @param reason The exception DevError object reason field
     * @param desc   The exception DevError object desc field
     * @param origin The exception DevError object origin field
     * @param sever  The exception DevError object severity field
     * @throws DevFailed The thrown exception.
     *                   Click <a href="../../tango_basic/idl_html/Tango.html#DevFailed">here</a> to read
     *                   <b>DevFailed</b> exception specification
     */
    public static void re_throw_exception(DevFailed ex,
                                          String reason, String desc, String origin, ErrSeverity sever)
            throws DevFailed {
        int nb_error = ex.errors.length;
        DevError[] err = new DevError[nb_error + 1];
        System.arraycopy(ex.errors, 0, err, 0, nb_error);
        err[nb_error] = new DevError();

        err[nb_error].desc = desc;
        err[nb_error].severity = sever;
        err[nb_error].reason = reason;
        err[nb_error].origin = origin;

        throw new DevFailed(err);
    }

    /**
     * Generate and throw a TANGO DevFailed exception from a CORBA exception.
     * <p/>
     * The exception is created with a single DevError
     * object. A value ERR is defined for the DevError
     * severity field.
     * Click <a href="../../tango_basic/idl_html/Tango.html#DevFailed">here</a> to read
     * <b>DevFailed</b> exception specification
     *
     * @param ex     A CORBA System Exception. The reason and desc fields of the
     *               DevError object will be set according to the data in this exception.
     *               The reason field is always set to API_CorbaSysException and the reason flag is
     *               different depending on the exact type of the CORBA system exception.
     * @param origin The exception DevError object origin field
     * @throws DevFailed The thrown exception.
     *                   Click <a href="../../tango_basic/idl_html/Tango.html#DevFailed">here</a> to read
     *                   <b>DevFailed</b> exception specification
     */
    public static void throw_exception(SystemException ex, String origin)
            throws DevFailed {
        DevError[] err = new DevError[1];
        err[0] = new DevError();

        err[0].desc = print_CORBA_SystemException(ex);
        err[0].severity = ErrSeverity.ERR;
        err[0].reason = "API_CorbaSysException";
        err[0].origin = origin;

        throw new DevFailed(err);
    }


    /**
     * Create a string from a CORBA excepition
     *
     * @param ex The CORBA exception
     */
    public static String print_CORBA_SystemException(SystemException ex) {

//
// get exception name
//

        String ex_name = ex.getClass().getName();
        int last_dot = ex_name.lastIndexOf('.');

//
// Unknown exception
//

        if (last_dot == -1) {
            return "Unknown system exception !!!!!!!!";
        }
        String ex_last_name = ex_name.substring(last_dot + 1);
        int before_last_dot = ex_name.lastIndexOf('.', last_dot - 1);

//
// Unknown exception
//

        if (before_last_dot == -1) {
            return "Unknown system exception !!!!!!!!";
        } else {
            String ex_part_name = ex_name.substring(before_last_dot + 1, last_dot);

            if (ex_part_name.equals("CORBA")) {

//
// CORBA System exception
//

                StringBuilder str = new StringBuilder("CORBA system exception ");
                str.append(ex_last_name);
                str.append(ex.getMessage());
                str.append("Completed: ");
                switch (ex.completed.value()) {
                    case CompletionStatus._COMPLETED_YES:
                        str.append("yes");
                        break;

                    case CompletionStatus._COMPLETED_NO:
                        str.append("no");
                        break;

                    case CompletionStatus._COMPLETED_MAYBE:
                        str.append("maybe");
                        break;
                }
                str.append("Minor code: ");
                str.append(ex.minor);

                return str.toString();
            } else {

//
// Unknown exeption
//
                return "Unknown system exception !!!!!!!!";

            }
        }
    }


//=======================================================================
/*
 *	Client exceptions management
 */
//=======================================================================
    //===================================================================
    /**
     * Throw a ConnectionFailed exception.
     *
     * @param reason The exception DevError object reason field
     * @param desc   The exception DevError object desc field
     * @param origin The exception DevError object origin field
     * @throws ConnectionFailed The client exception.
     */
    //===================================================================
    static public void throw_connection_failed(String reason, String desc, String origin)
            throws ConnectionFailed {
        throw_connection_failed(null,
                reason, desc, origin, ErrSeverity.from_int(ErrSeverity._PANIC));
    }
    //===================================================================
    /**
     * Re-throw a ConnectionFailed exception.
     *
     * @param df     A DevFailed exception to be rethrown.
     * @param reason The exception DevError object reason field
     * @param desc   The exception DevError object desc field
     * @param origin The exception DevError object origin field
     * @throws ConnectionFailed The client exception.
     */
    //===================================================================
    static public void throw_connection_failed(DevFailed df, String reason, String desc, String origin)
            throws ConnectionFailed {
        throw_connection_failed(df,
                reason, desc, origin, ErrSeverity.from_int(ErrSeverity._PANIC));
    }
    //===================================================================
    /**
     * Throw a ConnectionFailed exception.
     *
     * @param reason   The exception DevError object reason field
     * @param desc     The exception DevError object desc field
     * @param origin   The exception DevError object origin field
     * @param severity The exception DevError object severity field
     * @throws ConnectionFailed The client exception.
     */
    //===================================================================
    static public void throw_connection_failed(String reason, String desc, String origin, ErrSeverity severity)
            throws ConnectionFailed {
        throw_connection_failed(null,
                reason, desc, origin, severity);
    }
    //===================================================================
    /**
     * re-throw a DevFailed in a ConnectionFailed exception.
     *
     * @param df       A DevFailed exception to be rethrown.
     * @param reason   The exception DevError object reason field
     * @param desc     The exception DevError object desc field
     * @param origin   The exception DevError object origin field
     * @param severity The exception DevError object severity field
     * @throws ConnectionFailed The client exception.
     */
    //===================================================================
    static public void throw_connection_failed(DevFailed df, String reason, String desc, String origin, ErrSeverity severity)
            throws ConnectionFailed {

        DevError[] err;
        int i = 0;

        //	if DevFailed is null -> allocate
        if (df == null)
            err = new DevError[1];
        else {
            //	Else copy in new object
            err = new DevError[df.errors.length + 1];
            for (; i < df.errors.length; i++)
                err[i] = df.errors[i];
        }
        err[i] = new DevError(reason, severity, desc, origin);
        throw new ConnectionFailed(err);
    }
    //===================================================================
    /**
     * Throw a CommunicationFailed exception.
     *
     * @param reason The exception DevError object reason field
     * @param desc   The exception DevError object desc field
     * @param origin The exception DevError object origin field
     * @throws CommunicationFailed The client exception.
     */
    //===================================================================
    static public void throw_communication_failed(String reason, String desc, String origin)
            throws CommunicationFailed {
        throw_communication_failed(null,
                reason, desc, origin, ErrSeverity.from_int(ErrSeverity._ERR));
    }
    //===================================================================
    /**
     * Re-throw a CommunicationFailed exception.
     *
     * @param df     A DevFailed exception to be rethrown.
     * @param reason The exception DevError object reason field
     * @param desc   The exception DevError object desc field
     * @param origin The exception DevError object origin field
     * @throws CommunicationFailed The client exception.
     */
    //===================================================================
    static public void throw_communication_failed(DevFailed df, String reason, String desc, String origin)
            throws CommunicationFailed {
        throw_communication_failed(df,
                reason, desc, origin, ErrSeverity.from_int(ErrSeverity._ERR));
    }
    //===================================================================
    /**
     * Throw a CommunicationTimeout exception.
     *
     * @param reason The exception DevError object reason field
     * @param desc   The exception DevError object desc field
     * @param origin The exception DevError object origin field
     * @throws CommunicationTimeout The client exception.
     */
    //===================================================================
    static public void throw_communication_timeout(String reason, String desc, String origin)
            throws fr.esrf.TangoApi.CommunicationTimeout {
        throw_communication_timeout(null,
                reason, desc, origin, ErrSeverity.from_int(ErrSeverity._ERR));
    }
    //===================================================================
    /**
     * Throw a CommunicationFailed exception.
     *
     * @param reason   The exception DevError object reason field
     * @param desc     The exception DevError object desc field
     * @param origin   The exception DevError object origin field
     * @param severity The exception DevError object severity field
     * @throws CommunicationFailed The client exception.
     */
    //===================================================================
    static public void throw_communication_failed(String reason, String desc, String origin, ErrSeverity severity)
            throws CommunicationFailed {
        throw_communication_failed(null,
                reason, desc, origin, severity);
    }
    //===================================================================
    /**
     * re-throw a DevFailed in a CommunicationFailed exception.
     *
     * @param df       A DevFailed exception to be rethrown.
     * @param reason   The exception DevError object reason field
     * @param desc     The exception DevError object desc field
     * @param origin   The exception DevError object origin field
     * @param severity The exception DevError object severity field
     * @throws CommunicationFailed The client exception.
     */
    //===================================================================
    static public void throw_communication_failed(DevFailed df, String reason, String desc, String origin, ErrSeverity severity)
            throws CommunicationFailed {

        DevError[] err;
        int i = 0;

        //	if DevFailed is null -> allocate
        if (df == null)
            err = new DevError[1];
        else {
            //	Else copy in new object
            err = new DevError[df.errors.length + 1];
            for (; i < df.errors.length; i++)
                err[i] = df.errors[i];
        }
        err[i] = new DevError(reason, severity, desc, origin);
        throw new CommunicationFailed(err);
    }

    //===================================================================
    /**
     * re-throw a DevFailed in a CommunicationTimeout exception.
     *
     * @param df       A DevFailed exception to be rethrown.
     * @param reason   The exception DevError object reason field
     * @param desc     The exception DevError object desc field
     * @param origin   The exception DevError object origin field
     * @param severity The exception DevError object severity field
     * @throws CommunicationTimeout The client exception.
     */
    //===================================================================
    static public void throw_communication_timeout(DevFailed df, String reason, String desc, String origin, ErrSeverity severity)
            throws fr.esrf.TangoApi.CommunicationTimeout {

        DevError[] err;
        int i = 0;

        //  if DevFailed is null -> allocate
        if (df == null)
            err = new DevError[1];
        else {
            //  Else copy in new object
            err = new DevError[df.errors.length + 1];
            for (; i < df.errors.length; i++)
                err[i] = df.errors[i];
        }
        err[i] = new DevError(reason, severity, desc, origin);
        throw new fr.esrf.TangoApi.CommunicationTimeout(err);
    }
    //===================================================================
    /**
     * Throw a WrongNameSyntax exception.
     *
     * @param reason The exception DevError object reason field
     * @param desc   The exception DevError object desc field
     * @param origin The exception DevError object origin field
     * @throws WrongNameSyntax The client exception.
     */
    //===================================================================
    static public void throw_wrong_syntax_exception(String reason, String desc, String origin)
            throws WrongNameSyntax {
        throw_wrong_syntax_exception(null,
                reason, desc, origin, ErrSeverity.from_int(ErrSeverity._ERR));
    }
    //===================================================================
    /**
     * Re-throw a WrongNameSyntax exception.
     *
     * @param df     A DevFailed exception to be rethrown.
     * @param reason The exception DevError object reason field
     * @param desc   The exception DevError object desc field
     * @param origin The exception DevError object origin field
     * @throws WrongNameSyntax The client exception.
     */
    //===================================================================
    static public void throw_wrong_syntax_exception(DevFailed df, String reason, String desc, String origin)
            throws WrongNameSyntax {
        throw_wrong_syntax_exception(df,
                reason, desc, origin, ErrSeverity.from_int(ErrSeverity._ERR));
    }
    //===================================================================
    /**
     * Throw a WrongNameSyntax exception.
     *
     * @param reason   The exception DevError object reason field
     * @param desc     The exception DevError object desc field
     * @param origin   The exception DevError object origin field
     * @param severity The exception DevError object severity field
     * @throws WrongNameSyntax The client exception.
     */
    //===================================================================
    static public void throw_wrong_syntax_exception(String reason, String desc, String origin, ErrSeverity severity)
            throws WrongNameSyntax {
        throw_wrong_syntax_exception(null,
                reason, desc, origin, severity);
    }
    //===================================================================
    /**
     * re-throw a DevFailed in a WrongNameSyntax exception.
     *
     * @param df       A DevFailed exception to be rethrown.
     * @param reason   The exception DevError object reason field
     * @param desc     The exception DevError object desc field
     * @param origin   The exception DevError object origin field
     * @param severity The exception DevError object severity field
     * @throws WrongNameSyntax The client exception.
     */
    //===================================================================
    static public void throw_wrong_syntax_exception(DevFailed df, String reason, String desc, String origin, ErrSeverity severity)
            throws WrongNameSyntax {

        DevError[] err;
        int i = 0;

        //	if DevFailed is null -> allocate
        if (df == null)
            err = new DevError[1];
        else {
            //	Else copy in new object
            err = new DevError[df.errors.length + 1];
            for (; i < df.errors.length; i++)
                err[i] = df.errors[i];
        }
        err[i] = new DevError(reason, severity, desc, origin);
        throw new WrongNameSyntax(err);
    }

    //===================================================================
    /**
     * Throw a WrongData exception.
     *
     * @param reason The exception DevError object reason field
     * @param desc   The exception DevError object desc field
     * @param origin The exception DevError object origin field
     * @throws WrongData The client exception.
     */
    //===================================================================
    static public void throw_wrong_data_exception(String reason, String desc, String origin)
            throws WrongData {
        throw_wrong_data_exception(null,
                reason, desc, origin, ErrSeverity.from_int(ErrSeverity._ERR));
    }
    //===================================================================
    /**
     * Re-throw a WrongData exception.
     *
     * @param df     A DevFailed exception to be rethrown.
     * @param reason The exception DevError object reason field
     * @param desc   The exception DevError object desc field
     * @param origin The exception DevError object origin field
     * @throws WrongData The client exception.
     */
    //===================================================================
    static public void throw_wrong_data_exception(DevFailed df, String reason, String desc, String origin)
            throws WrongData {
        throw_wrong_data_exception(df,
                reason, desc, origin, ErrSeverity.from_int(ErrSeverity._ERR));
    }
    //===================================================================
    /**
     * Throw a WrongData exception.
     *
     * @param reason   The exception DevError object reason field
     * @param desc     The exception DevError object desc field
     * @param origin   The exception DevError object origin field
     * @param severity The exception DevError object severity field
     * @throws WrongData The client exception.
     */
    //===================================================================
    static public void throw_wrong_data_exception(String reason, String desc, String origin, ErrSeverity severity)
            throws WrongData {
        throw_wrong_data_exception(null,
                reason, desc, origin, severity);
    }
    //===================================================================
    /**
     * re-throw a DevFailed in a WrongData exception.
     *
     * @param df       A DevFailed exception to be rethrown.
     * @param reason   The exception DevError object reason field
     * @param desc     The exception DevError object desc field
     * @param origin   The exception DevError object origin field
     * @param severity The exception DevError object severity field
     * @throws WrongData The client exception.
     */
    //===================================================================
    static public void throw_wrong_data_exception(DevFailed df, String reason, String desc, String origin, ErrSeverity severity)
            throws WrongData {

        DevError[] err;
        int i = 0;

        //	if DevFailed is null -> allocate
        if (df == null)
            err = new DevError[1];
        else {
            //	Else copy in new object
            err = new DevError[df.errors.length + 1];
            for (; i < df.errors.length; i++)
                err[i] = df.errors[i];
        }
        err[i] = new DevError(reason, severity, desc, origin);
        throw new WrongData(err);
    }

    //===================================================================
    /**
     * Throw a NonDbDevice exception.
     *
     * @param reason The exception DevError object reason field
     * @param desc   The exception DevError object desc field
     * @param origin The exception DevError object origin field
     * @throws NonDbDevice The client exception.
     */
    //===================================================================
    static public void throw_non_db_exception(String reason, String desc, String origin)
            throws NonDbDevice {
        throw_non_db_exception(null,
                reason, desc, origin, ErrSeverity.from_int(ErrSeverity._ERR));
    }
    //===================================================================
    /**
     * Re-throw a NonDbDevice exception.
     *
     * @param df     A DevFailed exception to be rethrown.
     * @param reason The exception DevError object reason field
     * @param desc   The exception DevError object desc field
     * @param origin The exception DevError object origin field
     * @throws NonDbDevice The client exception.
     */
    //===================================================================
    static public void throw_non_db_exception(DevFailed df, String reason, String desc, String origin)
            throws NonDbDevice {
        throw_non_db_exception(df,
                reason, desc, origin, ErrSeverity.from_int(ErrSeverity._ERR));
    }
    //===================================================================
    /**
     * Throw a NonDbDevice exception.
     *
     * @param reason   The exception DevError object reason field
     * @param desc     The exception DevError object desc field
     * @param origin   The exception DevError object origin field
     * @param severity The exception DevError object severity field
     * @throws NonDbDevice The client exception.
     */
    //===================================================================
    static public void throw_non_db_exception(String reason, String desc, String origin, ErrSeverity severity)
            throws NonDbDevice {
        throw_non_db_exception(null,
                reason, desc, origin, severity);
    }
    //===================================================================
    /**
     * re-throw a DevFailed in a NonDbDevice exception.
     *
     * @param df       A DevFailed exception to be rethrown.
     * @param reason   The exception DevError object reason field
     * @param desc     The exception DevError object desc field
     * @param origin   The exception DevError object origin field
     * @param severity The exception DevError object severity field
     * @throws NonDbDevice The client exception.
     */
    //===================================================================
    static public void throw_non_db_exception(DevFailed df, String reason, String desc, String origin, ErrSeverity severity)
            throws NonDbDevice {

        DevError[] err;
        int i = 0;

        //	if DevFailed is null -> allocate
        if (df == null)
            err = new DevError[1];
        else {
            //	Else copy in new object
            err = new DevError[df.errors.length + 1];
            for (; i < df.errors.length; i++)
                err[i] = df.errors[i];
        }
        err[i] = new DevError(reason, severity, desc, origin);
        throw new NonDbDevice(err);
    }

    //===================================================================
    /**
     * Throw a NonSupportedFeature exception.
     *
     * @param reason The exception DevError object reason field
     * @param desc   The exception DevError object desc field
     * @param origin The exception DevError object origin field
     * @throws NonSupportedFeature The client exception.
     */
    //===================================================================
    static public void throw_non_supported_exception(String reason, String desc, String origin)
            throws NonSupportedFeature {
        throw_non_supported_exception(null,
                reason, desc, origin, ErrSeverity.from_int(ErrSeverity._ERR));
    }
    //===================================================================
    /**
     * Re-throw a NonSupportedFeature exception.
     *
     * @param df     A DevFailed exception to be rethrown.
     * @param reason The exception DevError object reason field
     * @param desc   The exception DevError object desc field
     * @param origin The exception DevError object origin field
     * @throws NonSupportedFeature The client exception.
     */
    //===================================================================
    static public void throw_non_supported_exception(DevFailed df, String reason, String desc, String origin)
            throws NonSupportedFeature {
        throw_non_supported_exception(df,
                reason, desc, origin, ErrSeverity.from_int(ErrSeverity._ERR));
    }
    //===================================================================
   /**
     * Throw a NonSupportedFeature exception.
     *
     * @param reason   The exception DevError object reason field
     * @param desc     The exception DevError object desc field
     * @param origin   The exception DevError object origin field
     * @param severity The exception DevError object severity field
     * @throws NonSupportedFeature The client exception.
     */
    //===================================================================
    static public void throw_non_supported_exception(String reason, String desc, String origin, ErrSeverity severity)
            throws NonSupportedFeature {
        throw_non_supported_exception(null,
                reason, desc, origin, severity);
    }
    //===================================================================
    /**
     * re-throw a DevFailed in a NonSupportedFeature exception.
     *
     * @param df       A DevFailed exception to be rethrown.
     * @param reason   The exception DevError object reason field
     * @param desc     The exception DevError object desc field
     * @param origin   The exception DevError object origin field
     * @param severity The exception DevError object severity field
     * @throws NonSupportedFeature The client exception.
     */
    //===================================================================
    static public void throw_non_supported_exception(DevFailed df, String reason, String desc, String origin, ErrSeverity severity)
            throws NonSupportedFeature {

        DevError[] err;
        int i = 0;

        //	if DevFailed is null -> allocate
        if (df == null)
            err = new DevError[1];
        else {
            //	Else copy in new object
            err = new DevError[df.errors.length + 1];
            for (; i < df.errors.length; i++)
                err[i] = df.errors[i];
        }
        err[i] = new DevError(reason, severity, desc, origin);
        throw new NonSupportedFeature(err);
    }

    //===================================================================
    /**
     * Throw a AsynReplyNotArrived exception.
     *
     * @param reason The exception DevError object reason field
     * @param desc   The exception DevError object desc field
     * @param origin The exception DevError object origin field
     * @throws AsynReplyNotArrived The client exception.
     */
    //===================================================================
    static public void throw_asyn_reply_not_arrived(String reason, String desc, String origin)
            throws AsynReplyNotArrived {
        throw_asyn_reply_not_arrived(null,
                reason, desc, origin, ErrSeverity.from_int(ErrSeverity._ERR));
    }
    //===================================================================
    /**
     * Re-throw a AsynReplyNotArrived exception.
     *
     * @param df     A DevFailed exception to be rethrown.
     * @param reason The exception DevError object reason field
     * @param desc   The exception DevError object desc field
     * @param origin The exception DevError object origin field
     * @throws AsynReplyNotArrived The client exception.
     */
    //===================================================================
    static public void throw_asyn_reply_not_arrived(DevFailed df, String reason, String desc, String origin)
            throws AsynReplyNotArrived {
        throw_asyn_reply_not_arrived(df,
                reason, desc, origin, ErrSeverity.from_int(ErrSeverity._ERR));
    }
    //===================================================================
    /**
     * Throw a AsynReplyNotArrived exception.
     *
     * @param reason   The exception DevError object reason field
     * @param desc     The exception DevError object desc field
     * @param origin   The exception DevError object origin field
     * @param severity The exception DevError object severity field
     * @throws AsynReplyNotArrived The client exception.
     */
    //===================================================================
    static public void throw_asyn_reply_not_arrived(String reason, String desc, String origin, ErrSeverity severity)
            throws AsynReplyNotArrived {
        throw_asyn_reply_not_arrived(null,
                reason, desc, origin, severity);
    }
    //===================================================================
    /**
     * re-throw a DevFailed in a AsynReplyNotArrived exception.
     *
     * @param df       A DevFailed exception to be rethrown.
     * @param reason   The exception DevError object reason field
     * @param desc     The exception DevError object desc field
     * @param origin   The exception DevError object origin field
     * @param severity The exception DevError object severity field
     * @throws AsynReplyNotArrived The client exception.
     */
    //===================================================================
    static public void throw_asyn_reply_not_arrived(DevFailed df, String reason, String desc, String origin, ErrSeverity severity)
            throws AsynReplyNotArrived {

        DevError[] err;
        int i = 0;

        //	if DevFailed is null -> allocate
        if (df == null)
            err = new DevError[1];
        else {
            //	Else copy in new object
            err = new DevError[df.errors.length + 1];
            for (; i < df.errors.length; i++)
                err[i] = df.errors[i];
        }
        err[i] = new DevError(reason, severity, desc, origin);
        throw new AsynReplyNotArrived(err);
    }

    //===================================================================
    /**
     * Throw a EventSystemFailed exception.
     *
     * @param reason The exception DevError object reason field
     * @param desc   The exception DevError object desc field
     * @param origin The exception DevError object origin field
     * @throws EventSystemFailed The client exception.
     */
    //===================================================================
    static public void throw_event_system_failed(String reason, String desc, String origin)
            throws EventSystemFailed {
        throw_event_system_failed(null,
                reason, desc, origin, ErrSeverity.from_int(ErrSeverity._ERR));
    }
    //===================================================================
    /**
     * Re-throw a EventSystemFailed exception.
     *
     * @param df     A DevFailed exception to be rethrown.
     * @param reason The exception DevError object reason field
     * @param desc   The exception DevError object desc field
     * @param origin The exception DevError object origin field
     * @throws EventSystemFailed The client exception.
     */
    //===================================================================
    static public void throw_event_system_failed(DevFailed df, String reason, String desc, String origin)
            throws EventSystemFailed {
        throw_event_system_failed(df,
                reason, desc, origin, ErrSeverity.from_int(ErrSeverity._ERR));
    }
    //===================================================================
    /**
     * Throw a EventSystemFailed exception.
     *
     * @param reason   The exception DevError object reason field
     * @param desc     The exception DevError object desc field
     * @param origin   The exception DevError object origin field
     * @param severity The exception DevError object severity field
     * @throws EventSystemFailed The client exception.
     */
    //===================================================================
    static public void throw_event_system_failed(String reason, String desc, String origin, ErrSeverity severity)
            throws EventSystemFailed {
        throw_event_system_failed(null,
                reason, desc, origin, severity);
    }
    //===================================================================
    /**
     * re-throw a DevFailed in a EventSystemFailed exception.
     *
     * @param df       A DevFailed exception to be rethrown.
     * @param reason   The exception DevError object reason field
     * @param desc     The exception DevError object desc field
     * @param origin   The exception DevError object origin field
     * @param severity The exception DevError object severity field
     * @throws EventSystemFailed The client exception.
     */
    //===================================================================
    static public void throw_event_system_failed(DevFailed df, String reason, String desc, String origin, ErrSeverity severity)
            throws EventSystemFailed {

        DevError[] err;
        int i = 0;

        //	if DevFailed is null -> allocate
        if (df == null)
            err = new DevError[1];
        else {
            //	Else copy in new object
            err = new DevError[df.errors.length + 1];
            for (; i < df.errors.length; i++)
                err[i] = df.errors[i];
        }
        err[i] = new DevError(reason, severity, desc, origin);
        throw new EventSystemFailed(err);
    }

}
652162
private static function handleRequestException (Throwable $ex) {
        ob_clean();
        $response = get_response();
        $response->clear();
        $errorRoutes = self::$errorRoutes->getRoutes();
        if (!empty($errorRoutes)) {
            foreach ($errorRoutes as $errorRoute) {
                $routeResult = self::executeAction($errorRoute->getAction(), array_merge($_REQUEST, $errorRoute->getParameters(), [Throwable::class => $ex, Exception::class => $ex]));
                if (!empty($routeResult)) {
                    $response->content($routeResult);
                }
            }
            $response->send();
        }
        else {
            throw $ex;
        }
    }
1280410
def formatException(self, exc_info, record=None):
        """"""
        if not record:
            return logging.Formatter.formatException(self, exc_info)

        stringbuffer = cStringIO.StringIO()
        traceback.print_exception(exc_info[0], exc_info[1], exc_info[2],
                                  None, stringbuffer)
        lines = stringbuffer.getvalue().split('\n')
        stringbuffer.close()

        if CONF.logging_exception_prefix.find('%(asctime)') != -1:
            record.asctime = self.formatTime(record, self.datefmt)

        formatted_lines = []
        for line in lines:
            pl = CONF.logging_exception_prefix % record.__dict__
            fl = '%s%s' % (pl, line)
            formatted_lines.append(fl)
        return '\n'.join(formatted_lines)
975391
def _handle_exception(self, exception):
        """"""
        try:
            return super(WebSocketRpcRequest, self)._handle_exception(exception)
        except Exception:
            if not isinstance(exception, (odoo.exceptions.Warning, odoo.http.SessionExpiredException, odoo.exceptions.except_orm)):
                _logger.exception("Exception during JSON request handling.")
            error = {
                    'code': 200,
                    'message': "Odoo Server Error",
                    'data': odoo.http.serialize_exception(exception)
            }
            if isinstance(exception, odoo.http.AuthenticationError):
                error['code'] = 100
                error['message'] = "Odoo Session Invalid"
            if isinstance(exception, odoo.http.SessionExpiredException):
                error['code'] = 100
                error['message'] = "Odoo Session Expired"
            return self._json_response(error=error)
745774
public void requestFailed (Exception cause)
    {
        Object[] args = _args != null ? ArrayUtil.append(_args, cause) : new Object[] { cause };
        if (_slogger != null) {
            _slogger.warning(_errorText, args);
        } else if (_jlogger != null) {
            _jlogger.log(Level.WARNING, Logger.format(_errorText, args), cause);
        } else {
            System.err.println(Logger.format(_errorText, args));
        }
    }
682540
def exception_logger(exc_type, exc_value, exc_traceback):
    """"""
    if not issubclass(exc_type, KeyboardInterrupt):  # do not log Ctrl-C
        _log.critical(
            "Uncaught exception:",
            exc_info=(exc_type, exc_value, exc_traceback)
        )
    sys.__excepthook__(exc_type, exc_value, exc_traceback)