Skip to content

Commit 2971244

Browse files
authored
Merge pull request #1207 from YadaYadaSoftware/fix/error-message
Fix/error message type name
2 parents 7209c7c + ca2d605 commit 2971244

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

Libraries/src/Amazon.Lambda.RuntimeSupport/Bootstrap/InvokeDelegateBuilder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ private Expression CreateSerializeExpression(object customerSerializerInstance,
320320
if (customerSerializerInstance == null)
321321
{
322322
throw LambdaExceptions.ValidationException(Errors.UserCodeLoader.SerializeMissingAttribute,
323-
_handler.AssemblyName, _handler.MethodName, dataType.FullName);
323+
_handler.AssemblyName, _handler.MethodName, dataType.FullName, typeof(LambdaSerializerAttribute).FullName);
324324
}
325325

326326
iLambdaSerializerType = customerSerializerInstance
@@ -372,7 +372,7 @@ private Expression CreateDeserializeExpression(object customerSerializerInstance
372372
if (customerSerializerInstance == null)
373373
{
374374
throw LambdaExceptions.ValidationException(Errors.UserCodeLoader.DeserializeMissingAttribute,
375-
_handler.AssemblyName, _handler.MethodName, dataType.FullName);
375+
_handler.AssemblyName, _handler.MethodName, dataType.FullName, typeof(LambdaSerializerAttribute).FullName);
376376
}
377377

378378
genericTypes = new[] {dataType};

Libraries/src/Amazon.Lambda.RuntimeSupport/ExceptionHandling/Errors.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ internal static class Internal
3232
public const string CouldNotFindHandlerAssembly = "Could not find the specified handler assembly with the file name '{0}'. The assembly should be located in the root of your uploaded .zip file.";
3333
public const string UnableToLoadAssembly = "Unable to load assembly '{0}'.";
3434
public const string UnableToLoadType = "Unable to load type '{0}' from assembly '{1}'.";
35-
public const string DeserializeMissingAttribute = "Could not find the LambdaSerializerAttribute on the assembly '{0}' or method '{1}' while attempting to deserialize input data of type '{2}'. To use types other than System.IO.Stream as input/output parameters, the assembly or Lambda function should be annotated with Amazon.Lambda.LambdaSerializerAttribute.";
36-
public const string SerializeMissingAttribute = "Could not find the LambdaSerializerAttribute on the assembly '{0}' or method '{1}' while attempting to serialize output data of type '{2}'. To use types other than System.IO.Stream as input/output parameters, the assembly or Lambda function should be annotated with Amazon.Lambda.LambdaSerializerAttribute.";
35+
public const string DeserializeMissingAttribute = "Could not find the LambdaSerializerAttribute on the assembly '{0}' or method '{1}' while attempting to deserialize input data of type '{2}'. To use types other than System.IO.Stream as input/output parameters, the assembly or Lambda function should be annotated with {3}.";
36+
public const string SerializeMissingAttribute = "Could not find the LambdaSerializerAttribute on the assembly '{0}' or method '{1}' while attempting to serialize output data of type '{2}'. To use types other than System.IO.Stream as input/output parameters, the assembly or Lambda function should be annotated with {3}.";
3737
public const string MethodTooManyParams = "Method '{0}' of type '{1}' is not supported: the method has more than 2 parameters.";
3838
public const string MethodSecondParamNotContext = "Method '{0}' of type '{1}' is not supported: the method has 2 parameters, but the second parameter is not of type '{2}'.";
3939
public const string NoMatchingMethod = "Unable to find method '{0}' in type '{1}' from assembly '{2}': Found no methods matching method name '{3}'.";

Libraries/test/Amazon.Lambda.RuntimeSupport.Tests/Amazon.Lambda.RuntimeSupport.UnitTests/HandlerTests.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
using System.Text;
2222
using System.Threading;
2323
using System.Threading.Tasks;
24+
using Amazon.Lambda.Core;
2425
using Amazon.Lambda.RuntimeSupport.Bootstrap;
2526
using Amazon.Lambda.RuntimeSupport.ExceptionHandling;
2627
using Amazon.Lambda.RuntimeSupport.Helpers;
@@ -149,8 +150,8 @@ public async Task NegativeBootstrapInitTestsAsync()
149150
await TestHandlerFailAsync("HandlerTest::HandlerTest.CustomerType::TwoInputsNoContextMethod", "is not supported: the method has 2 parameters, but the second parameter is not of type");
150151
await TestHandlerFailAsync("HandlerTest::HandlerTest.CustomerType::TooManyInputsMethod", "is not supported: the method has more than 2 parameters.");
151152

152-
await TestHandlerFailAsync("HandlerTestNoSerializer::HandlerTestNoSerializer.CustomerType::PocoInPocoOut", "To use types other than System.IO.Stream as input/output parameters, the assembly or Lambda function should be annotated with Amazon.Lambda.LambdaSerializerAttribute.");
153-
await TestHandlerFailAsync("HandlerTestNoSerializer::HandlerTestNoSerializer.CustomerType::PocoInPocoOut", "To use types other than System.IO.Stream as input/output parameters, the assembly or Lambda function should be annotated with Amazon.Lambda.LambdaSerializerAttribute.");
153+
await TestHandlerFailAsync("HandlerTestNoSerializer::HandlerTestNoSerializer.CustomerType::PocoInPocoOut", $"To use types other than System.IO.Stream as input/output parameters, the assembly or Lambda function should be annotated with {typeof(LambdaSerializerAttribute).FullName}.");
154+
await TestHandlerFailAsync("HandlerTestNoSerializer::HandlerTestNoSerializer.CustomerType::PocoInPocoOut", $"To use types other than System.IO.Stream as input/output parameters, the assembly or Lambda function should be annotated with {typeof(LambdaSerializerAttribute).FullName}.");
154155

155156
var noZeroParamTypeEx = await TestHandlerFailAsync("HandlerTest::HandlerTest.NoZeroParamConstructorCustomerType::SimpleMethod", "No parameterless constructor defined");
156157
Assert.IsAssignableFrom<MissingMethodException>(noZeroParamTypeEx);

0 commit comments

Comments
 (0)