C
C#16mo ago
Johnny

❔ Hellang ProblemDetails with AWS - returnung AWS exception/ AWS Exception handling

Hey, having some issues with Hellang ProblemDetails and AWS Cognito authentication -
internal static class Startup
{
internal static IServiceCollection ExceptionInjections(this IServiceCollection services)
{
services.AddProblemDetails(setup =>
{
setup.IncludeExceptionDetails = (ctx, ex) =>
{
return false;
};
setup.MapToStatusCode<ValidationException>(400);
setup.MapToStatusCode<NotImplementedException>(501);
setup.MapToStatusCode<UserNotFoundException>(404);
setup.MapToStatusCode<UsernameExistsException>(409);
setup.MapToStatusCode<NotAuthorizedException>(400);
setup.MapToStatusCode<InvalidParameterException>(400);
setup.MapToStatusCode<InvalidLambdaResponseException>(400);
...

});
return services;
}
}
internal static class Startup
{
internal static IServiceCollection ExceptionInjections(this IServiceCollection services)
{
services.AddProblemDetails(setup =>
{
setup.IncludeExceptionDetails = (ctx, ex) =>
{
return false;
};
setup.MapToStatusCode<ValidationException>(400);
setup.MapToStatusCode<NotImplementedException>(501);
setup.MapToStatusCode<UserNotFoundException>(404);
setup.MapToStatusCode<UsernameExistsException>(409);
setup.MapToStatusCode<NotAuthorizedException>(400);
setup.MapToStatusCode<InvalidParameterException>(400);
setup.MapToStatusCode<InvalidLambdaResponseException>(400);
...

});
return services;
}
}
am I using to not show errors but for some reason they always appear:
Error: response status is 500

Response body
Download
Amazon.CognitoIdentityProvider.Model.UserNotFoundException: User does not exist.
---> Amazon.Runtime.Internal.HttpErrorResponseException: Exception of type 'Amazon.Runtime.Internal.HttpErrorResponseException' was thrown.
at Amazon.Runtime.HttpWebRequestMessage.GetResponseAsync(CancellationToken cancellationToken)
....
--- End of inner exception stack trace ---
at Amazon.Runtime.Internal.HttpErrorResponseExceptionHandler.HandleExceptionStream(IRequestContext requestContext, IWebResponseData httpErrorResponse, HttpErrorResponseException exception, Stream responseStream)
....
Error: response status is 500

Response body
Download
Amazon.CognitoIdentityProvider.Model.UserNotFoundException: User does not exist.
---> Amazon.Runtime.Internal.HttpErrorResponseException: Exception of type 'Amazon.Runtime.Internal.HttpErrorResponseException' was thrown.
at Amazon.Runtime.HttpWebRequestMessage.GetResponseAsync(CancellationToken cancellationToken)
....
--- End of inner exception stack trace ---
at Amazon.Runtime.Internal.HttpErrorResponseExceptionHandler.HandleExceptionStream(IRequestContext requestContext, IWebResponseData httpErrorResponse, HttpErrorResponseException exception, Stream responseStream)
....
1 Reply
Accord
Accord15mo ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server