Esempio n. 1
0
 /// <param name="exception">Exception from Rpc request</param>
 /// <param name="showServerExceptions">
 /// Optional. If true the inner exceptions to errors (possibly from server code) will be shown. Defaults to false.
 /// </param>
 public RpcError(RpcException exception, bool showServerExceptions)
 {
     if (exception == null)
     {
         throw new ArgumentNullException(nameof(exception));
     }
     this.Code    = (int)exception.ErrorCode;
     this.Message = RpcError.GetErrorMessage(exception, showServerExceptions);
     this.Data    = exception.RpcData;
 }
Esempio n. 2
0
        private static string GetErrorMessage(Exception exception, bool showServerExceptions)
        {
            string message = exception.Message;

            if (showServerExceptions && exception.InnerException != null)
            {
                message += "\tInner Exception: " + RpcError.GetErrorMessage(exception.InnerException, showServerExceptions);
            }
            return(message);
        }