Пример #1
0
 /// <summary>
 /// Sends an error response to a query request.
 /// </summary>
 public void Error(ResError error)
 {
     try
     {
         RawResponse(JsonUtils.Serialize(new ErrorDto(error)));
     }
     catch (Exception ex)
     {
         Service.OnError("Error serializing error query response: {0}", ex.Message);
         RawResponse(ResService.ResponseInternalError);
     }
 }
Пример #2
0
 /// <summary>
 /// Sends an error response to a request.
 /// </summary>
 public void Error(ResError error)
 {
     try
     {
         byte[] data = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(new ErrorDto(error)));
         RawResponse(data);
     }
     catch (Exception ex)
     {
         Service.OnError("Error serializing error response: {0}", ex.Message);
         RawResponse(ResService.ResponseInternalError);
     }
 }
Пример #3
0
 internal async Task ExecuteHandler()
 {
     try
     {
         await Handler.Handle(this);
     }
     catch (ResException ex)
     {
         if (replied)
         {
             Service.OnError("Error in value get request for {0}: {1} - {2}", ResourceName, ex.Code, ex.Message);
         }
         else
         {
             ErrorResult = new ResError(ex);
         }
     }
     catch (Exception ex)
     {
         // Log error and rethrow as only ResExceptions are considered valid behaviour
         Service.OnError("Error in value get request for {0}: {1}", ResourceName, ex.Message);
         throw ex;
     }
 }
Пример #4
0
 public void Error(ResError error)
 {
     Calls.Add(new Call("Error", new object[] { error }));
 }
Пример #5
0
 public ResException(ResError error, Exception inner)
     : base(error.Message, inner)
 {
     Code      = error.Code;
     ErrorData = error.Data;
 }
Пример #6
0
 public ErrorDto(ResError error)
 {
     Error = error;
 }
Пример #7
0
 public void Error(ResError error)
 {
     reply();
     ErrorResult = error;
 }