-
Notifications
You must be signed in to change notification settings - Fork 275
Expand file tree
/
Copy pathOpenApiUnsupportedSpecVersionException.cs
More file actions
44 lines (39 loc) · 1.89 KB
/
OpenApiUnsupportedSpecVersionException.cs
File metadata and controls
44 lines (39 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using System;
using System.Globalization;
namespace Microsoft.OpenApi.Exceptions
{
/// <summary>
/// Defines an exception indicating OpenAPI Reader encountered an unsupported specification version while reading.
/// </summary>
[Serializable]
public class OpenApiUnsupportedSpecVersionException : Exception
{
const string messagePattern = "OpenAPI specification version '{0}' is not supported.";
/// <summary>
/// Initializes the <see cref="OpenApiUnsupportedSpecVersionException"/> class with a specification version.
/// </summary>
/// <param name="specificationVersion">Version that caused this exception to be thrown.</param>
public OpenApiUnsupportedSpecVersionException(string? specificationVersion)
: base(string.Format(CultureInfo.InvariantCulture, messagePattern, specificationVersion))
{
this.SpecificationVersion = specificationVersion;
}
/// <summary>
/// Initializes the <see cref="OpenApiUnsupportedSpecVersionException"/> class with a specification version and
/// inner exception.
/// </summary>
/// <param name="specificationVersion">Version that caused this exception to be thrown.</param>
/// <param name="innerException">Inner exception that caused this exception to be thrown.</param>
public OpenApiUnsupportedSpecVersionException(string specificationVersion, Exception innerException)
: base(string.Format(CultureInfo.InvariantCulture, messagePattern, specificationVersion), innerException)
{
this.SpecificationVersion = specificationVersion;
}
/// <summary>
/// The unsupported specification version.
/// </summary>
public string? SpecificationVersion { get; }
}
}