Skip to content

Conversation

@mhoeger
Copy link
Contributor

@mhoeger mhoeger commented Mar 3, 2021

Instead of keeping the input as null if we are unable to convert it, we should throw (or at least warn) why the input is null.

Example:

[2021-03-03T07:32:17.585Z] Executed 'Functions.HelloFromQuery' (Failed, Id=e2f3400d-23a8-4a1e-8bee-b3268a652376, Duration=195ms)
[2021-03-03T07:32:17.590Z] System.Private.CoreLib: Exception while executing function: Functions.HelloFromQuery. System.Private.CoreLib: Result: Failure
Exception: System.InvalidCastException: Cannot convert input parameter 'req' for Function 'HelloFromQuery' to type 'System.String' from type 'Microsoft.Azure.Functions.Worker.GrpcHttpRequestData'.

@mhoeger mhoeger force-pushed the mhoeger/throwIfNoConverter branch from 0cfd9c2 to 5ae84ea Compare March 3, 2021 19:34
@mhoeger mhoeger force-pushed the mhoeger/throwIfNoConverter branch from fba14c6 to 2f8c529 Compare March 4, 2021 21:37
@mhoeger
Copy link
Contributor Author

mhoeger commented Mar 4, 2021

Increasing test coverage tracked here: #230

internal class FunctionInputConverterException : FunctionWorkerException
{
internal FunctionInputConverterException(string message) : base(message) { }

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this have a property for the function name?

/// <summary>
/// Internal exception that is surfaced to the user
/// </summary>
internal class FunctionWorkerException : Exception
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you defining this to serve as the base for worker exceptions?

@mhoeger mhoeger merged commit 1c613b0 into main Mar 5, 2021
@mhoeger mhoeger deleted the mhoeger/throwIfNoConverter branch March 5, 2021 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants