Skip to content

Commit f513e13

Browse files
committed
Simplified exception handling
1 parent cca306e commit f513e13

File tree

1 file changed

+0
-20
lines changed

1 file changed

+0
-20
lines changed

src/Microsoft.OpenApi.Readers/OpenApiStreamReader.cs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,6 @@ public OpenApiDocument Read(Stream input, out OpenApiDiagnostic diagnostic)
4949
{
5050
yamlDocument = LoadYamlDocument(input);
5151
}
52-
catch (SemanticErrorException ex)
53-
{
54-
diagnostic.Errors.Add(new OpenApiError($"#line={ex.Start.Line}", ex.Message));
55-
return new OpenApiDocument();
56-
}
57-
catch (SyntaxErrorException ex)
58-
{
59-
diagnostic.Errors.Add(new OpenApiError($"#line={ex.Start.Line}", ex.Message));
60-
return new OpenApiDocument();
61-
}
6252
catch (YamlException ex)
6353
{
6454
diagnostic.Errors.Add(new OpenApiError($"#char={ex.Start.Line}", ex.Message));
@@ -132,16 +122,6 @@ public T ReadFragment<T>(Stream input, OpenApiSpecVersion version, out OpenApiDi
132122
{
133123
yamlDocument = LoadYamlDocument(input);
134124
}
135-
catch (SyntaxErrorException ex)
136-
{
137-
diagnostic.Errors.Add(new OpenApiError($"#line={ex.Start.Line}", ex.Message));
138-
return default(T);
139-
}
140-
catch (SemanticErrorException ex)
141-
{
142-
diagnostic.Errors.Add(new OpenApiError($"#line={ex.Start.Line}", ex.Message));
143-
return default(T);
144-
}
145125
catch (YamlException ex)
146126
{
147127
diagnostic.Errors.Add(new OpenApiError($"#line={ex.Start.Line}", ex.Message));

0 commit comments

Comments
 (0)