< Summary

Class:Microsoft.Azure.CognitiveServices.Search.CustomSearch.Models.Error
Assembly:Microsoft.Azure.CognitiveServices.Search.BingCustomSearch
File(s):C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Search.BingCustomSearch\src\Generated\CustomSearch\Models\Error.cs
Covered lines:0
Uncovered lines:21
Coverable lines:21
Total lines:125
Line coverage:0% (0 of 21)
Covered branches:0
Total branches:4
Branch coverage:0% (0 of 4)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-0%100%
get_Code()-0%100%
get_SubCode()-0%100%
get_Message()-0%100%
get_MoreDetails()-0%100%
get_Parameter()-0%100%
get_Value()-0%100%
Validate()-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Search.BingCustomSearch\src\Generated\CustomSearch\Models\Error.cs

#LineLine coverage
 1// <auto-generated>
 2// Code generated by Microsoft (R) AutoRest Code Generator.
 3// Changes may cause incorrect behavior and will be lost if the code is
 4// regenerated.
 5// </auto-generated>
 6
 7namespace Microsoft.Azure.CognitiveServices.Search.CustomSearch.Models
 8{
 9    using Microsoft.Rest;
 10    using Newtonsoft.Json;
 11    using System.Linq;
 12
 13    /// <summary>
 14    /// Defines the error that occurred.
 15    /// </summary>
 16    public partial class Error
 17    {
 18        /// <summary>
 19        /// Initializes a new instance of the Error class.
 20        /// </summary>
 021        public Error()
 22        {
 23            CustomInit();
 024        }
 25
 26        /// <summary>
 27        /// Initializes a new instance of the Error class.
 28        /// </summary>
 29        /// <param name="code">The error code that identifies the category of
 30        /// error. Possible values include: 'None', 'ServerError',
 31        /// 'InvalidRequest', 'RateLimitExceeded', 'InvalidAuthorization',
 32        /// 'InsufficientAuthorization'</param>
 33        /// <param name="message">A description of the error.</param>
 34        /// <param name="subCode">The error code that further helps to identify
 35        /// the error. Possible values include: 'UnexpectedError',
 36        /// 'ResourceError', 'NotImplemented', 'ParameterMissing',
 37        /// 'ParameterInvalidValue', 'HttpNotAllowed', 'Blocked',
 38        /// 'AuthorizationMissing', 'AuthorizationRedundancy',
 39        /// 'AuthorizationDisabled', 'AuthorizationExpired'</param>
 40        /// <param name="moreDetails">A description that provides additional
 41        /// information about the error.</param>
 42        /// <param name="parameter">The parameter in the request that caused
 43        /// the error.</param>
 44        /// <param name="value">The parameter's value in the request that was
 45        /// not valid.</param>
 046        public Error(string code, string message, string subCode = default(string), string moreDetails = default(string)
 47        {
 048            Code = code;
 049            SubCode = subCode;
 050            Message = message;
 051            MoreDetails = moreDetails;
 052            Parameter = parameter;
 053            Value = value;
 54            CustomInit();
 055        }
 56
 57        /// <summary>
 58        /// An initialization method that performs custom operations like setting defaults
 59        /// </summary>
 60        partial void CustomInit();
 61
 62        /// <summary>
 63        /// Gets or sets the error code that identifies the category of error.
 64        /// Possible values include: 'None', 'ServerError', 'InvalidRequest',
 65        /// 'RateLimitExceeded', 'InvalidAuthorization',
 66        /// 'InsufficientAuthorization'
 67        /// </summary>
 68        [JsonProperty(PropertyName = "code")]
 069        public string Code { get; set; }
 70
 71        /// <summary>
 72        /// Gets the error code that further helps to identify the error.
 73        /// Possible values include: 'UnexpectedError', 'ResourceError',
 74        /// 'NotImplemented', 'ParameterMissing', 'ParameterInvalidValue',
 75        /// 'HttpNotAllowed', 'Blocked', 'AuthorizationMissing',
 76        /// 'AuthorizationRedundancy', 'AuthorizationDisabled',
 77        /// 'AuthorizationExpired'
 78        /// </summary>
 79        [JsonProperty(PropertyName = "subCode")]
 080        public string SubCode { get; private set; }
 81
 82        /// <summary>
 83        /// Gets or sets a description of the error.
 84        /// </summary>
 85        [JsonProperty(PropertyName = "message")]
 086        public string Message { get; set; }
 87
 88        /// <summary>
 89        /// Gets a description that provides additional information about the
 90        /// error.
 91        /// </summary>
 92        [JsonProperty(PropertyName = "moreDetails")]
 093        public string MoreDetails { get; private set; }
 94
 95        /// <summary>
 96        /// Gets the parameter in the request that caused the error.
 97        /// </summary>
 98        [JsonProperty(PropertyName = "parameter")]
 099        public string Parameter { get; private set; }
 100
 101        /// <summary>
 102        /// Gets the parameter's value in the request that was not valid.
 103        /// </summary>
 104        [JsonProperty(PropertyName = "value")]
 0105        public string Value { get; private set; }
 106
 107        /// <summary>
 108        /// Validate the object.
 109        /// </summary>
 110        /// <exception cref="ValidationException">
 111        /// Thrown if validation fails
 112        /// </exception>
 113        public virtual void Validate()
 114        {
 0115            if (Code == null)
 116            {
 0117                throw new ValidationException(ValidationRules.CannotBeNull, "Code");
 118            }
 0119            if (Message == null)
 120            {
 0121                throw new ValidationException(ValidationRules.CannotBeNull, "Message");
 122            }
 0123        }
 124    }
 125}