< Summary

Class:Azure.ResourceManager.Compute.Models.ApiError
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\ApiError.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\ApiError.Serialization.cs
Covered lines:0
Uncovered lines:66
Coverable lines:66
Total lines:168
Line coverage:0% (0 of 66)
Covered branches:0
Total branches:38
Branch coverage:0% (0 of 38)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-0%100%
get_Details()-0%100%
get_Innererror()-0%100%
get_Code()-0%100%
get_Target()-0%100%
get_Message()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeApiError(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\ApiError.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System.Collections.Generic;
 9
 10namespace Azure.ResourceManager.Compute.Models
 11{
 12    /// <summary> Api error. </summary>
 13    public partial class ApiError
 14    {
 15        /// <summary> Initializes a new instance of ApiError. </summary>
 016        public ApiError()
 17        {
 018        }
 19
 20        /// <summary> Initializes a new instance of ApiError. </summary>
 21        /// <param name="details"> The Api error details. </param>
 22        /// <param name="innererror"> The Api inner error. </param>
 23        /// <param name="code"> The error code. </param>
 24        /// <param name="target"> The target of the particular error. </param>
 25        /// <param name="message"> The error message. </param>
 026        internal ApiError(IList<ApiErrorBase> details, InnerError innererror, string code, string target, string message
 27        {
 028            Details = details;
 029            Innererror = innererror;
 030            Code = code;
 031            Target = target;
 032            Message = message;
 033        }
 34
 35        /// <summary> The Api error details. </summary>
 036        public IList<ApiErrorBase> Details { get; set; }
 37        /// <summary> The Api inner error. </summary>
 038        public InnerError Innererror { get; set; }
 39        /// <summary> The error code. </summary>
 040        public string Code { get; set; }
 41        /// <summary> The target of the particular error. </summary>
 042        public string Target { get; set; }
 43        /// <summary> The error message. </summary>
 044        public string Message { get; set; }
 45    }
 46}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\ApiError.Serialization.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System.Collections.Generic;
 9using System.Text.Json;
 10using Azure.Core;
 11
 12namespace Azure.ResourceManager.Compute.Models
 13{
 14    public partial class ApiError : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            if (Details != null)
 20            {
 021                writer.WritePropertyName("details");
 022                writer.WriteStartArray();
 023                foreach (var item in Details)
 24                {
 025                    writer.WriteObjectValue(item);
 26                }
 027                writer.WriteEndArray();
 28            }
 029            if (Innererror != null)
 30            {
 031                writer.WritePropertyName("innererror");
 032                writer.WriteObjectValue(Innererror);
 33            }
 034            if (Code != null)
 35            {
 036                writer.WritePropertyName("code");
 037                writer.WriteStringValue(Code);
 38            }
 039            if (Target != null)
 40            {
 041                writer.WritePropertyName("target");
 042                writer.WriteStringValue(Target);
 43            }
 044            if (Message != null)
 45            {
 046                writer.WritePropertyName("message");
 047                writer.WriteStringValue(Message);
 48            }
 049            writer.WriteEndObject();
 050        }
 51
 52        internal static ApiError DeserializeApiError(JsonElement element)
 53        {
 054            IList<ApiErrorBase> details = default;
 055            InnerError innererror = default;
 056            string code = default;
 057            string target = default;
 058            string message = default;
 059            foreach (var property in element.EnumerateObject())
 60            {
 061                if (property.NameEquals("details"))
 62                {
 063                    if (property.Value.ValueKind == JsonValueKind.Null)
 64                    {
 65                        continue;
 66                    }
 067                    List<ApiErrorBase> array = new List<ApiErrorBase>();
 068                    foreach (var item in property.Value.EnumerateArray())
 69                    {
 070                        if (item.ValueKind == JsonValueKind.Null)
 71                        {
 072                            array.Add(null);
 73                        }
 74                        else
 75                        {
 076                            array.Add(ApiErrorBase.DeserializeApiErrorBase(item));
 77                        }
 78                    }
 079                    details = array;
 080                    continue;
 81                }
 082                if (property.NameEquals("innererror"))
 83                {
 084                    if (property.Value.ValueKind == JsonValueKind.Null)
 85                    {
 86                        continue;
 87                    }
 088                    innererror = InnerError.DeserializeInnerError(property.Value);
 089                    continue;
 90                }
 091                if (property.NameEquals("code"))
 92                {
 093                    if (property.Value.ValueKind == JsonValueKind.Null)
 94                    {
 95                        continue;
 96                    }
 097                    code = property.Value.GetString();
 098                    continue;
 99                }
 0100                if (property.NameEquals("target"))
 101                {
 0102                    if (property.Value.ValueKind == JsonValueKind.Null)
 103                    {
 104                        continue;
 105                    }
 0106                    target = property.Value.GetString();
 0107                    continue;
 108                }
 0109                if (property.NameEquals("message"))
 110                {
 0111                    if (property.Value.ValueKind == JsonValueKind.Null)
 112                    {
 113                        continue;
 114                    }
 0115                    message = property.Value.GetString();
 116                    continue;
 117                }
 118            }
 0119            return new ApiError(details, innererror, code, target, message);
 120        }
 121    }
 122}