You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, there is no ResultStatus that may be mapped to the 500error code since the ErrorResultStatus maps (quite rightly, in my opinion) to a 422Unprocessableerror code.
However, I have the following specific case:
publicasyncTask<ActionResult<Result>>RegisterTaxInfoForCurrentCustomer(ClaimsPrincipaluser,NewCorporateTaxInfoRequestrequest){try{varcustomer=awaitFindCustomerFromAuthenticatedUser(user);if(customerisnull)returnResult.NotFound("Customer not found");vartaxAddress=GetTaxAddressFromCustomerById(customer,request.TaxAddressId);if(taxAddressisnull)returnResult.NotFound("Tax address not found");vartaxInfo=request.ToCorporateTaxInfo(customer,taxAddress);customer.AddTaxInfo(taxInfo);await_customerRepository.UpdateAsync(customer);returnResult.Success();}catch(UserIdCannotBeRetrievedexception){Console.WriteLine(exception);returnResult.Error("Authentication failed");}catch(InvalidTaxAddressIdexception){Console.WriteLine(exception);returnexception.ToInvalidResult(nameof(request.TaxAddressId));}catch(InvalidTaxIdexception){Console.WriteLine(exception);returnexception.ToInvalidResult(nameof(request.TaxId));}}
The UserIdCannotBeRetirevedexception is thrown when the IDP did not set the subclaim. This, in my opinion, is a critical error and should return an InternalServerError (status 500) since this is not an issue with anything the user has done.
The Proposal:
A new CriticalErrorResultStatus that maps to an InternalServerError (500) status code.
I have a pull request with my take on this issue: #141
The text was updated successfully, but these errors were encountered:
EnochMtzR
added a commit
to EnochMtzR/Result
that referenced
this issue
Jun 16, 2023
Specific Case:
The Issue:
Currently, there is no
ResultStatus
that may be mapped to the500
error code since theError
ResultStatus
maps (quite rightly, in my opinion) to a422
Unprocessable
error code.However, I have the following specific case:
The
UserIdCannotBeRetireved
exception is thrown when the IDP did not set thesub
claim. This, in my opinion, is a critical error and should return anInternalServerError
(status500
) since this is not an issue with anything the user has done.The Proposal:
A new
CriticalError
ResultStatus
that maps to anInternalServerError
(500
) status code.I have a pull request with my take on this issue: #141
The text was updated successfully, but these errors were encountered: