Skip to content

Commit ef428b1

Browse files
authored
fix(readers): throw asyncapiexception, as this is handled by the main reader. (LEGO#80)
1 parent 05155d3 commit ef428b1

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

src/LEGO.AsyncAPI.Readers/V2/AsyncApiChannelBindingDeserializer.cs

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

33
namespace LEGO.AsyncAPI.Readers
44
{
5+
using LEGO.AsyncAPI.Exceptions;
56
using LEGO.AsyncAPI.Models;
67
using LEGO.AsyncAPI.Models.Bindings;
78
using LEGO.AsyncAPI.Models.Interfaces;
@@ -45,7 +46,7 @@ internal static IChannelBinding LoadChannelBinding(ParseNode node)
4546
case BindingType.Websockets:
4647
return LoadBinding("ChannelBinding", property.Value, webSocketsChannelBindingFixedFields);
4748
default:
48-
throw new System.Exception("ChannelBinding not found");
49+
throw new AsyncApiException($"ChannelBinding {property.Name} is not supported");
4950
}
5051
}
5152
}

src/LEGO.AsyncAPI.Readers/V2/AsyncApiMessageBindingDeserializer.cs

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

33
namespace LEGO.AsyncAPI.Readers
44
{
5+
using LEGO.AsyncAPI.Exceptions;
56
using LEGO.AsyncAPI.Extensions;
67
using LEGO.AsyncAPI.Models;
78
using LEGO.AsyncAPI.Models.Bindings;
@@ -48,7 +49,7 @@ internal static IMessageBinding LoadMessageBinding(ParseNode node)
4849
case BindingType.Http:
4950
return LoadBinding<HttpMessageBinding>("MessageBinding", property.Value, httpMessageBindingFixedFields);
5051
default:
51-
throw new System.Exception("MessageBinding not found");
52+
throw new AsyncApiException($"MessageBinding {property.Name} is not supported");
5253
}
5354
}
5455
}

src/LEGO.AsyncAPI.Readers/V2/AsyncApiOperationBindingDeserializer.cs

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

33
namespace LEGO.AsyncAPI.Readers
44
{
5+
using LEGO.AsyncAPI.Exceptions;
56
using LEGO.AsyncAPI.Models;
67
using LEGO.AsyncAPI.Models.Bindings;
78
using LEGO.AsyncAPI.Models.Interfaces;
@@ -45,7 +46,7 @@ internal static IOperationBinding LoadOperationBinding(ParseNode node)
4546
case BindingType.Http:
4647
return LoadBinding("OperationBinding", property.Value, httpOperationBindingFixedFields);
4748
default:
48-
throw new System.Exception("OperationBinding not found");
49+
throw new AsyncApiException($"OperationBinding {property.Name} is not supported");
4950
}
5051
}
5152
}

src/LEGO.AsyncAPI.Readers/V2/AsyncApiServerBindingDeserializer.cs

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

33
namespace LEGO.AsyncAPI.Readers
44
{
5+
using LEGO.AsyncAPI.Exceptions;
56
using LEGO.AsyncAPI.Models;
67
using LEGO.AsyncAPI.Models.Bindings;
78
using LEGO.AsyncAPI.Models.Interfaces;
@@ -43,7 +44,7 @@ internal static IServerBinding LoadServerBinding(ParseNode node)
4344
case BindingType.Kafka:
4445
return LoadBinding("ServerBinding", property.Value, kafkaServerBindingFixedFields);
4546
default:
46-
throw new System.Exception("ServerBinding not found");
47+
throw new AsyncApiException($"ServerBinding {property.Name} is not supported");
4748
}
4849
}
4950
}

0 commit comments

Comments
 (0)