Beispiel #1
0
 /// <summary>
 /// Initializes a <see cref="IErrorInfo"/> instance for no role.
 /// </summary>
 /// <param name="errorInfo">The <see cref="IErrorInfo"/> instance to update.</param>
 /// <param name="protocol">The protocol the role was requested on.</param>
 /// <param name="role">The requested role.</param>
 /// <returns>The initialized <see cref="IErrorInfo"/> instance.</returns>
 public static IErrorInfo NoRole(this IErrorInfo errorInfo, int protocol, string role)
 {
     return(errorInfo.Set(EtpErrorCodes.NoRole,
                          $"No Role: Protocol: {protocol}; Role: {role}"));
 }
Beispiel #2
0
 /// <summary>
 /// Sets the properties of the specified <see cref="IErrorInfo"/> instance.
 /// </summary>
 /// <param name="errorInfo">The <see cref="IErrorInfo"/> instance to update.</param>
 /// <param name="errorCode">The error code.</param>
 /// <param name="errorMessage">The error message.</param>
 /// <returns>The initialized <see cref="IErrorInfo"/> instance.</returns>
 public static IErrorInfo Set(this IErrorInfo errorInfo, EtpErrorCodes errorCode, string errorMessage)
 {
     return(errorInfo.Set((int)errorCode, errorMessage));
 }
Beispiel #3
0
 /// <summary>
 /// Initializes a <see cref="IErrorInfo"/> instance for a unset type.
 /// </summary>
 /// <param name="errorInfo">The <see cref="IErrorInfo"/> instance to update.</param>
 /// <param name="messageType">The message type.</param>
 /// <returns>The initialized <see cref="IErrorInfo"/> instance.</returns>
 public static IErrorInfo Unset(this IErrorInfo errorInfo, long messageType)
 {
     return(errorInfo.Set(EtpErrorCodes.Unset,
                          $"Unset: {messageType}"));
 }
Beispiel #4
0
 /// <summary>
 /// Sends a <see cref="IProtocolException" /> message for compression not supported.
 /// </summary>
 /// <param name="errorInfo">The <see cref="IErrorInfo"/> instance to update.</param>
 /// <returns>The <see cref="IProtocolException" /> message identifier.</returns>
 public static IErrorInfo CompressionNotSupported(this IErrorInfo errorInfo)
 {
     return(errorInfo.Set(EtpErrorCodes.CompressionNotSupported,
                          $"Compression Not Supported"));
 }
Beispiel #5
0
 /// <summary>
 /// Initializes a <see cref="IErrorInfo"/> instance for an invalid object.
 /// </summary>
 /// <param name="errorInfo">The <see cref="IErrorInfo"/> instance to update.</param>
 /// <param name="uri">The URI.</param>
 /// <param name="message">The optional error message.</param>
 /// <returns>The initialized <see cref="IErrorInfo"/> instance.</returns>
 public static IErrorInfo InvalidObject(this IErrorInfo errorInfo, string uri, string message = null)
 {
     return(errorInfo.Set(EtpErrorCodes.InvalidObject,
                          $"Invalid Object. URI: {uri}{(message == null ? string.Empty : $"; {message}")}"));
Beispiel #6
0
 /// <summary>
 /// Initializes a <see cref="IErrorInfo"/> instance for object not found.
 /// </summary>
 /// <param name="errorInfo">The <see cref="IErrorInfo"/> instance to update.</param>
 /// <param name="argument">The argument name.</param>
 /// <param name="value">The argument value.</param>
 /// <returns>The initialized <see cref="IErrorInfo"/> instance.</returns>
 public static IErrorInfo NotFound(this IErrorInfo errorInfo, string argument, object value)
 {
     return(errorInfo.Set(EtpErrorCodes.InvalidArgument,
                          $"Not Found: Argument {argument}; Value '{value}'"));
 }
Beispiel #7
0
 /// <summary>
 /// Initializes a <see cref="IErrorInfo"/> instance for limit exceeded.
 /// </summary>
 /// <param name="errorInfo">The <see cref="IErrorInfo"/> instance to update.</param>
 /// <param name="value">The argument value.</param>
 /// <returns>The initialized <see cref="IErrorInfo"/> instance.</returns>
 public static IErrorInfo LimitExceeded(this IErrorInfo errorInfo, object value)
 {
     return(errorInfo.Set(EtpErrorCodes.LimitExceeded,
                          $"Limit Exceeded: {value}"));
 }
Beispiel #8
0
 /// <summary>
 /// Initializes a <see cref="IErrorInfo"/> instance for an expired token.
 /// </summary>
 /// <param name="errorInfo">The <see cref="IErrorInfo"/> instance to update.</param>
 /// <returns>The initialized <see cref="IErrorInfo"/> instance.</returns>
 public static IErrorInfo ExpiredToken(this IErrorInfo errorInfo)
 {
     return(errorInfo.Set(EtpErrorCodes.ExpiredToken,
                          $"Expired Token"));
 }
Beispiel #9
0
 /// <summary>
 /// Initializes a <see cref="IErrorInfo"/> instance for object not found.
 /// </summary>
 /// <param name="errorInfo">The <see cref="IErrorInfo"/> instance to update.</param>
 /// <param name="value">The argument value.</param>
 /// <returns>The initialized <see cref="IErrorInfo"/> instance.</returns>
 public static IErrorInfo NotFound(this IErrorInfo errorInfo, object value)
 {
     return(errorInfo.Set(EtpErrorCodes.NotFound,
                          $"Not Found: {value}"));
 }
Beispiel #10
0
 /// <summary>
 /// Initializes a <see cref="IErrorInfo"/> instance for an invalid state.
 /// </summary>
 /// <param name="errorInfo">The <see cref="IErrorInfo"/> instance to update.</param>
 /// <returns>The initialized <see cref="IErrorInfo"/> instance.</returns>
 public static IErrorInfo InvalidState(this IErrorInfo errorInfo, string message)
 {
     return(errorInfo.Set(EtpErrorCodes.InvalidState,
                          $"Invalid State{(string.IsNullOrEmpty(message) ? string.Empty : $": {message}")}"));
 }
Beispiel #11
0
 /// <summary>
 /// Initializes a <see cref="IErrorInfo"/> instance for an invalid URI.
 /// </summary>
 /// <param name="errorInfo">The <see cref="IErrorInfo"/> instance to update.</param>
 /// <param name="uri">The invalid uri.</param>
 /// <returns>The initialized <see cref="IErrorInfo"/> instance.</returns>
 public static IErrorInfo InvalidUri(this IErrorInfo errorInfo, string uri)
 {
     return(errorInfo.Set(EtpErrorCodes.InvalidUri,
                          $"Invalid URI: {uri}"));
 }
Beispiel #12
0
 /// <summary>
 /// Initializes a <see cref="IErrorInfo"/> instance for not supported.
 /// </summary>
 /// <param name="errorInfo">The <see cref="IErrorInfo"/> instance to update.</param>
 /// <returns>The initialized <see cref="IErrorInfo"/> instance.</returns>
 public static IErrorInfo NotSupported(this IErrorInfo errorInfo)
 {
     return(errorInfo.Set(EtpErrorCodes.NotSupported,
                          $"Not Supported"));
 }
Beispiel #13
0
 /// <summary>
 /// Initializes a <see cref="IErrorInfo"/> instance for permission denied.
 /// </summary>
 /// <param name="errorInfo">The <see cref="IErrorInfo"/> instance to update.</param>
 /// <param name="message">The message to provide.</param>
 /// <returns>The initialized <see cref="IErrorInfo"/> instance.</returns>
 public static IErrorInfo RequestDenied(this IErrorInfo errorInfo, string message)
 {
     return(errorInfo.Set(EtpErrorCodes.RequestDenied,
                          $"{(errorInfo.EtpVersion == EtpVersion.v11 ? "Permission Denied" : "Request Denied")}{(string.IsNullOrEmpty(message) ? string.Empty : $": {message}")}"));
 }
Beispiel #14
0
 /// <summary>
 /// Initializes a <see cref="IErrorInfo"/> instance for an unsupported protocol.
 /// </summary>
 /// <param name="errorInfo">The <see cref="IErrorInfo"/> instance to update.</param>
 /// <param name="protocol">The unsupported protocol.</param>
 /// <returns>The initialized <see cref="IErrorInfo"/> instance.</returns>
 public static IErrorInfo UnsupportedProtocol(this IErrorInfo errorInfo, int protocol)
 {
     return(errorInfo.Set(EtpErrorCodes.UnsupportedProtocol,
                          $"Unsupported Protocol: {protocol}"));
 }
Beispiel #15
0
 /// <summary>
 /// Initializes a <see cref="IErrorInfo"/> instance for an invalid message type.
 /// </summary>
 /// <param name="errorInfo">The <see cref="IErrorInfo"/> instance to update.</param>
 /// <param name="protocol">The message's protocol.</param>
 /// <param name="messageType">The message type.</param>
 /// <returns>The initialized <see cref="IErrorInfo"/> instance.</returns>
 public static IErrorInfo InvalidMessageType(this IErrorInfo errorInfo, int protocol, long messageType)
 {
     return(errorInfo.Set(EtpErrorCodes.InvalidMessageType,
                          $"Invalid Message Type: Protocol: {protocol}; Message Type: {messageType}"));
 }
Beispiel #16
0
 /// <summary>
 /// Initializes a <see cref="IErrorInfo"/> instance for no supported protocols.
 /// </summary>
 /// <param name="errorInfo">The <see cref="IErrorInfo"/> instance to update.</param>
 /// <returns>The initialized <see cref="IErrorInfo"/> instance.</returns>
 public static IErrorInfo NoSupportedProtocols(this IErrorInfo errorInfo)
 {
     return(errorInfo.Set(EtpErrorCodes.NoSupportedProtocols,
                          $"No Supported Protocols"));
 }