Skip to content

Commit e13fb01

Browse files
committed
throw OpenApiException for it to be caught gracefully and appended to diagnostics
1 parent e12301c commit e13fb01

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Microsoft.OpenApi/Extensions/OpenApiTypeMapper.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System;
55
using System.Collections.Generic;
6+
using Microsoft.OpenApi.Exceptions;
67
using Microsoft.OpenApi.Models;
78

89
namespace Microsoft.OpenApi.Extensions
@@ -49,7 +50,7 @@ public static JsonSchemaType IdentifierToEnumType(string identifier)
4950
"array" => JsonSchemaType.Array,
5051
"object" => JsonSchemaType.Object,
5152
"file" => JsonSchemaType.String, // File is treated as string
52-
_ => throw new ArgumentException("Invalid schema type identifier", nameof(identifier))
53+
_ => throw new OpenApiException(string.Format("Invalid schema type identifier", identifier))
5354
};
5455
}
5556

0 commit comments

Comments
 (0)