c#中的异常(处理)

Rae*_*leh 0 c# exception-handling custom-exceptions

  catch (Exception ex)
  {
     _errorCode = ErrorCodes.SqlGeneralError;
     CommonTools.vAddToLog(ex, _errorCode, _userID);
     throw new JOVALException(_errorCode);
 }
Run Code Online (Sandbox Code Playgroud)

我使用这个代码的和平来处理调用的自定义异常的错误(JOVALException)但是当发生异常时它打开"No source available"页面并且告诉我不是堆栈跟踪 是空的我怎么能解决这个问题?

编辑

 public JOVALException(ErrorCodes _errCode, String _message = "")
        {
            ErrMessage = _message;
            ErrCode = _errCode;

        }
Run Code Online (Sandbox Code Playgroud)

这是我的构造函数,如何修改它?

Seb*_*zus 5

exJOVALException作为一个内在的例外.

public JOVALException(ErrorCodes _errCode, String _message = "",
  Exception innerException = null) : base(_message, innerException)
{
  ErrMessage = _message;
  ErrCode = _errCode;
}
Run Code Online (Sandbox Code Playgroud)