示例#1
0
    public void WriteEntry(Exception e)
    {
        try
        {
            EventLogEntryType type = EventLogEntryType.Error;
            int eventId            = (int)BPMExceptionType.UserException;

            BPMException bpmExp = e as BPMException;
            if (bpmExp != null)
            {
                type    = bpmExp.LogType;
                eventId = (int)bpmExp.ExceptionType;
            }

            this.WriteEntry(TrimEventMessage(e.Message), type, eventId);
        }
        catch (Exception exp)
        {
            try
            {
                //日志满
                EventLog.Delete(YZEventLog.EventLogName);

                this.WriteEntry(new BPMException(BPMExceptionType.EventLogReset, exp.Message));
                this.WriteEntry(e);
            }
            catch
            {
            }
        }
    }
示例#2
0
        internal static Result FromException(Exception exp)
        {
            BPMException bpmexp = exp as BPMException;

            Result result = new Result();

            result.Success = false;

            if (bpmexp != null)
            {
                result.ErrorCode = (int)bpmexp.ExceptionType;
                result.ErrorName = bpmexp.ExceptionType.ToString();
            }
            else
            {
                result.ErrorCode = (int)BPMExceptionType.UnKnowError;
                result.ErrorName = BPMExceptionType.UnKnowError.ToString();
            }
            result.ErrorMessage = exp.Message;

            return(result);
        }