-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #229 from gigya/develop
Throw InvalidParameterValueException in case parameter value is invalid
- Loading branch information
Showing
15 changed files
with
316 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
Gigya.ServiceContract/Exceptions/InvalidParameterValueException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using System; | ||
using System.Runtime.Serialization; | ||
using Gigya.Common.Contracts.Exceptions; | ||
using Newtonsoft.Json; | ||
|
||
namespace Gigya.ServiceContract.Exceptions | ||
{ | ||
/// <summary> | ||
/// This excpetion is thrown if a parameter contains an invalid value | ||
/// </summary> | ||
[Serializable] | ||
public class InvalidParameterValueException: RequestException | ||
{ | ||
///<summary>ErrorCode of Invalid_parameter_value</summary> | ||
public override int? ErrorCode => 400006; | ||
|
||
/// <summary> | ||
/// Name of the parameter which has an invalid value | ||
/// </summary> | ||
[JsonProperty] | ||
public string parameterName { get; set; } | ||
|
||
/// <summary> | ||
/// For parameters that contain data structures, the path inside the data structure pointing to the field/property that | ||
/// caused the deserialization or validation error. | ||
/// </summary> | ||
public string[] ErrorPath { get; set; } | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="InvalidParameterValueException"/> class with a specified error message and a reference to the inner exception that is the cause of this exception. | ||
/// </summary> | ||
/// <param name="paramName">Name of the parameter which has an invalid value</param> | ||
/// <param name="errorPath">For parameters that contain data structures, the path inside the data structure pointing to the field/property that | ||
/// caused the deserialization or validation error.</param> | ||
/// <param name="message">The error message that explains the reason for the exception.</param> | ||
/// <param name="encrypted">Optional. A collection of type <see cref="Tags"/> that contains additional data about the exception, which must be encrypted when stored.</param> | ||
/// <param name="unencrypted">Optional. A collection of type <see cref="Tags"/> that contains additional data about the exception, which needn't be encrypted when stored.</param> | ||
/// <param name="innerException">Optional. The exception that is the cause of the current exception.</param> | ||
public InvalidParameterValueException(string paramName, string[] errorPath, string message, Exception innerException = null, Tags encrypted = null, Tags unencrypted = null) : base(message, innerException, encrypted, unencrypted) | ||
{ | ||
parameterName = paramName; | ||
ErrorPath = errorPath; | ||
} | ||
|
||
/// <summary>Initializes a new instance of the <see cref="InvalidParameterValueException"/> class with serialized data.</summary> | ||
/// <param name="info"> The <see cref="SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param> | ||
/// <param name="context">The <see cref="StreamingContext"/> that contains contextual information about the source or destination.</param> | ||
/// <exception cref="ArgumentNullException">The <paramref name="info"/> parameter is null.</exception> | ||
/// <exception cref="SerializationException">The class name is null or <see cref="Exception.HResult"/> is zero (0). </exception> | ||
public InvalidParameterValueException(SerializationInfo info, StreamingContext context) : base(info, context) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.