< Summary

Class:Azure.Search.Documents.Indexes.Models.SearchServiceError
Assembly:Azure.Search.Documents
File(s):C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SearchServiceError.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SearchServiceError.Serialization.cs
Covered lines:0
Uncovered lines:30
Coverable lines:30
Total lines:96
Line coverage:0% (0 of 30)
Covered branches:0
Total branches:12
Branch coverage:0% (0 of 12)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-0%100%
get_Code()-0%100%
get_Message()-0%100%
get_Details()-0%100%
DeserializeSearchServiceError(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SearchServiceError.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;
 9using System.Collections.Generic;
 10using Azure.Core;
 11
 12namespace Azure.Search.Documents.Indexes.Models
 13{
 14    /// <summary> Describes an error condition for the Azure Cognitive Search API. </summary>
 15    internal partial class SearchServiceError
 16    {
 17        /// <summary> Initializes a new instance of SearchServiceError. </summary>
 18        /// <param name="message"> A human-readable representation of the error. </param>
 19        /// <exception cref="ArgumentNullException"> <paramref name="message"/> is null. </exception>
 020        internal SearchServiceError(string message)
 21        {
 022            if (message == null)
 23            {
 024                throw new ArgumentNullException(nameof(message));
 25            }
 26
 027            Message = message;
 028            Details = new ChangeTrackingList<SearchServiceError>();
 029        }
 30
 31        /// <summary> Initializes a new instance of SearchServiceError. </summary>
 32        /// <param name="code"> One of a server-defined set of error codes. </param>
 33        /// <param name="message"> A human-readable representation of the error. </param>
 34        /// <param name="details"> An array of details about specific errors that led to this reported error. </param>
 035        internal SearchServiceError(string code, string message, IReadOnlyList<SearchServiceError> details)
 36        {
 037            Code = code;
 038            Message = message;
 039            Details = details;
 040        }
 41
 42        /// <summary> One of a server-defined set of error codes. </summary>
 043        public string Code { get; }
 44        /// <summary> A human-readable representation of the error. </summary>
 045        public string Message { get; }
 46        /// <summary> An array of details about specific errors that led to this reported error. </summary>
 047        public IReadOnlyList<SearchServiceError> Details { get; }
 48    }
 49}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SearchServiceError.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.Search.Documents.Indexes.Models
 13{
 14    internal partial class SearchServiceError
 15    {
 16        internal static SearchServiceError DeserializeSearchServiceError(JsonElement element)
 17        {
 018            Optional<string> code = default;
 019            string message = default;
 020            Optional<IReadOnlyList<SearchServiceError>> details = default;
 021            foreach (var property in element.EnumerateObject())
 22            {
 023                if (property.NameEquals("code"))
 24                {
 025                    code = property.Value.GetString();
 026                    continue;
 27                }
 028                if (property.NameEquals("message"))
 29                {
 030                    message = property.Value.GetString();
 031                    continue;
 32                }
 033                if (property.NameEquals("details"))
 34                {
 035                    List<SearchServiceError> array = new List<SearchServiceError>();
 036                    foreach (var item in property.Value.EnumerateArray())
 37                    {
 038                        array.Add(DeserializeSearchServiceError(item));
 39                    }
 040                    details = array;
 41                    continue;
 42                }
 43            }
 044            return new SearchServiceError(code.Value, message, Optional.ToList(details));
 45        }
 46    }
 47}