mirror of https://github.com/abpframework/abp.git
3 changed files with 163 additions and 0 deletions
@ -0,0 +1,91 @@ |
|||
using System; |
|||
|
|||
namespace Volo.Abp.Http |
|||
{ |
|||
/// <summary>
|
|||
/// Used to store information about an error.
|
|||
/// </summary>
|
|||
[Serializable] |
|||
public class RemoteServiceErrorInfo |
|||
{ |
|||
/// <summary>
|
|||
/// Error code.
|
|||
/// </summary>
|
|||
public int Code { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Error message.
|
|||
/// </summary>
|
|||
public string Message { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Error details.
|
|||
/// </summary>
|
|||
public string Details { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Validation errors if exists.
|
|||
/// </summary>
|
|||
public RemoteServiceValidationErrorInfo[] ValidationErrors { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Creates a new instance of <see cref="RemoteServiceErrorInfo"/>.
|
|||
/// </summary>
|
|||
public RemoteServiceErrorInfo() |
|||
{ |
|||
|
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Creates a new instance of <see cref="RemoteServiceErrorInfo"/>.
|
|||
/// </summary>
|
|||
/// <param name="message">Error message</param>
|
|||
public RemoteServiceErrorInfo(string message) |
|||
{ |
|||
Message = message; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Creates a new instance of <see cref="RemoteServiceErrorInfo"/>.
|
|||
/// </summary>
|
|||
/// <param name="code">Error code</param>
|
|||
public RemoteServiceErrorInfo(int code) |
|||
{ |
|||
Code = code; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Creates a new instance of <see cref="RemoteServiceErrorInfo"/>.
|
|||
/// </summary>
|
|||
/// <param name="code">Error code</param>
|
|||
/// <param name="message">Error message</param>
|
|||
public RemoteServiceErrorInfo(int code, string message) |
|||
: this(message) |
|||
{ |
|||
Code = code; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Creates a new instance of <see cref="RemoteServiceErrorInfo"/>.
|
|||
/// </summary>
|
|||
/// <param name="message">Error message</param>
|
|||
/// <param name="details">Error details</param>
|
|||
public RemoteServiceErrorInfo(string message, string details) |
|||
: this(message) |
|||
{ |
|||
Details = details; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Creates a new instance of <see cref="RemoteServiceErrorInfo"/>.
|
|||
/// </summary>
|
|||
/// <param name="code">Error code</param>
|
|||
/// <param name="message">Error message</param>
|
|||
/// <param name="details">Error details</param>
|
|||
public RemoteServiceErrorInfo(int code, string message, string details) |
|||
: this(message, details) |
|||
{ |
|||
Code = code; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
namespace Volo.Abp.Http |
|||
{ |
|||
public abstract class RemoteServiceErrorResponse |
|||
{ |
|||
public RemoteServiceErrorInfo Error { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// A special signature of ABP.
|
|||
/// </summary>
|
|||
public bool __abp { get; } = true; |
|||
} |
|||
} |
|||
@ -0,0 +1,60 @@ |
|||
using System; |
|||
|
|||
namespace Volo.Abp.Http |
|||
{ |
|||
/// <summary>
|
|||
/// Used to store information about a validation error.
|
|||
/// </summary>
|
|||
[Serializable] |
|||
public class RemoteServiceValidationErrorInfo |
|||
{ |
|||
/// <summary>
|
|||
/// Validation error message.
|
|||
/// </summary>
|
|||
public string Message { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Relate invalid members (fields/properties).
|
|||
/// </summary>
|
|||
public string[] Members { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// Creates a new instance of <see cref="RemoteServiceValidationErrorInfo"/>.
|
|||
/// </summary>
|
|||
public RemoteServiceValidationErrorInfo() |
|||
{ |
|||
|
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Creates a new instance of <see cref="RemoteServiceValidationErrorInfo"/>.
|
|||
/// </summary>
|
|||
/// <param name="message">Validation error message</param>
|
|||
public RemoteServiceValidationErrorInfo(string message) |
|||
{ |
|||
Message = message; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Creates a new instance of <see cref="RemoteServiceValidationErrorInfo"/>.
|
|||
/// </summary>
|
|||
/// <param name="message">Validation error message</param>
|
|||
/// <param name="members">Related invalid members</param>
|
|||
public RemoteServiceValidationErrorInfo(string message, string[] members) |
|||
: this(message) |
|||
{ |
|||
Members = members; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Creates a new instance of <see cref="RemoteServiceValidationErrorInfo"/>.
|
|||
/// </summary>
|
|||
/// <param name="message">Validation error message</param>
|
|||
/// <param name="member">Related invalid member</param>
|
|||
public RemoteServiceValidationErrorInfo(string message, string member) |
|||
: this(message, new[] { member }) |
|||
{ |
|||
|
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue