< Summary

Class:Microsoft.Azure.OperationalInsights.Models.ErrorInfo
Assembly:Microsoft.Azure.OperationalInsights
File(s):C:\Git\azure-sdk-for-net\sdk\operationalinsights\Microsoft.Azure.OperationalInsights\src\Customized\Models\ErrorInfo.cs
C:\Git\azure-sdk-for-net\sdk\operationalinsights\Microsoft.Azure.OperationalInsights\src\Generated\Models\ErrorInfo.cs
Covered lines:5
Uncovered lines:28
Coverable lines:33
Total lines:135
Line coverage:15.1% (5 of 33)
Covered branches:0
Total branches:18
Branch coverage:0% (0 of 18)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_Code()-100%100%
get_Message()-100%100%
get_Details()-100%100%
get_Innererror()-100%100%
get_AdditionalProperties()-100%100%
Validate()-100%100%
.ctor(...)-100%100%
PrettyPrint(...)-0%0%
.ctor()-100%100%
.ctor()-100%100%
.ctor(...)-0%100%
get_Code()-100%100%
get_Message()-0%100%
get_Details()-0%100%
get_Innererror()-100%100%
get_AdditionalProperties()-0%100%
Validate()-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\operationalinsights\Microsoft.Azure.OperationalInsights\src\Customized\Models\ErrorInfo.cs

#LineLine coverage
 1using System.Text;
 2
 3namespace Microsoft.Azure.OperationalInsights.Models
 4{
 5    public partial class ErrorInfo
 6    {
 7        internal void PrettyPrint(StringBuilder sb, string indentation = "")
 8        {
 09            sb.AppendLine($"{indentation}Code={Code}, Message={Message}");
 010            if (Details != null)
 11            {
 012                foreach (var detail in Details)
 13                {
 014                    detail.PrettyPrint(sb, $"{indentation}    ");
 15                }
 16            }
 17
 018            if (Innererror != null)
 19            {
 020                Innererror.PrettyPrint(sb, $"{indentation}  ");
 21            }
 022        }
 523    }
 24}

C:\Git\azure-sdk-for-net\sdk\operationalinsights\Microsoft.Azure.OperationalInsights\src\Generated\Models\ErrorInfo.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.OperationalInsights.Models
 8{
 9    using Microsoft.Rest;
 10    using Newtonsoft.Json;
 11    using System.Collections;
 12    using System.Collections.Generic;
 13    using System.Linq;
 14
 15    /// <summary>
 16    /// The code and message for an error.
 17    /// </summary>
 18    public partial class ErrorInfo
 19    {
 20        /// <summary>
 21        /// Initializes a new instance of the ErrorInfo class.
 22        /// </summary>
 523        public ErrorInfo()
 24        {
 25            CustomInit();
 526        }
 27
 28        /// <summary>
 29        /// Initializes a new instance of the ErrorInfo class.
 30        /// </summary>
 31        /// <param name="code">A machine readable error code.</param>
 32        /// <param name="message">A human readable error message.</param>
 33        /// <param name="details">error details.</param>
 34        /// <param name="innererror">Inner error details if they exist.</param>
 035        public ErrorInfo(string code, string message, IList<ErrorDetail> details = default(IList<ErrorDetail>), ErrorInf
 36        {
 037            Code = code;
 038            Message = message;
 039            Details = details;
 040            Innererror = innererror;
 041            AdditionalProperties = additionalProperties;
 42            CustomInit();
 043        }
 44
 45        /// <summary>
 46        /// An initialization method that performs custom operations like setting defaults
 47        /// </summary>
 48        partial void CustomInit();
 49
 50        /// <summary>
 51        /// Gets or sets a machine readable error code.
 52        /// </summary>
 53        [JsonProperty(PropertyName = "code")]
 954        public string Code { get; set; }
 55
 56        /// <summary>
 57        /// Gets or sets a human readable error message.
 58        /// </summary>
 59        [JsonProperty(PropertyName = "message")]
 060        public string Message { get; set; }
 61
 62        /// <summary>
 63        /// Gets or sets error details.
 64        /// </summary>
 65        [JsonProperty(PropertyName = "details")]
 066        public IList<ErrorDetail> Details { get; set; }
 67
 68        /// <summary>
 69        /// Gets or sets inner error details if they exist.
 70        /// </summary>
 71        [JsonProperty(PropertyName = "innererror")]
 872        public ErrorInfo Innererror { get; set; }
 73
 74        /// <summary>
 75        /// </summary>
 76        [JsonProperty(PropertyName = "additionalProperties")]
 077        public object AdditionalProperties { get; set; }
 78
 79        /// <summary>
 80        /// Validate the object.
 81        /// </summary>
 82        /// <exception cref="ValidationException">
 83        /// Thrown if validation fails
 84        /// </exception>
 85        public virtual void Validate()
 86        {
 087            if (Code == null)
 88            {
 089                throw new ValidationException(ValidationRules.CannotBeNull, "Code");
 90            }
 091            if (Message == null)
 92            {
 093                throw new ValidationException(ValidationRules.CannotBeNull, "Message");
 94            }
 095            if (Details != null)
 96            {
 097                foreach (var element in Details)
 98                {
 099                    if (element != null)
 100                    {
 0101                        element.Validate();
 102                    }
 103                }
 104            }
 0105            if (Innererror != null)
 106            {
 0107                Innererror.Validate();
 108            }
 0109        }
 110    }
 111}