API error messages not getting passed
ehosch opened this issue · comments
Tried creating a user with username less than 6 characters, and the error object is null and nothing happens. Tested with the swagger interface and the error message works there.
I'm currently experiencing this issue and still trying to figure out the issue
@iammukeshm
Issues
- Create a new Product
- Enter an existing product name
- Select Brand and enter a rate
- Click Submit
Expected Behaviour
- Fails validation and displays Prospect already exists to the user in the Blazor application
Current Behaviour
- Something went wrong
Quick helpful debugging
In the APIHelper.cs code below, ex.Result.Errors are null
catch (ApiException<HttpValidationProblemDetails> ex)
{
if (ex.Result.Errors is not null)
{
customValidation?.DisplayErrors(ex.Result.Errors);
}
else
{
snackbar.Add("Something went wrong!", Severity.Error);
}
}
Facing Same issue . Any update about that issue?
I am facing the same issue. I thought the error was because of my model validation problems but I even tried it with the example Product and Brand ...... The same thing is displayed.
@iammukeshm Issues
* Create a new Product * Enter an existing product name * Select Brand and enter a rate * Click Submit
Expected Behaviour
* Fails validation and displays Prospect already exists to the user in the Blazor application
Current Behaviour
* Something went wrong
Quick helpful debugging In the APIHelper.cs code below, ex.Result.Errors are null
catch (ApiException<HttpValidationProblemDetails> ex) { if (ex.Result.Errors is not null) { customValidation?.DisplayErrors(ex.Result.Errors); } else { snackbar.Add("Something went wrong!", Severity.Error); } }
Not working this way! Any updates? Thanks!
Hello all,
I'm facing the same issue. I tried to search by myself.
When we have a validation error, if for exemple we try to add a product with an existing name, the error is managed by ExceptionMiddleware (FSH.WebApi) et it write the response with an object of type ErrorResult (FSH.WebApi).
The message arrived to blazor client. You can show it with DevTools with an error code 400.
But it is not displayed. We have "Something went wrong" !
If we take a look inside FSHApi.cs generated with NSwag, we can see that error 400 is not an ErrorResult but a HttpProblemValidationDetails that's why, I guess, like @kristian014 told us, ex.Result.Error is null !
I saw a file FSHApiConvention
I don't know, maybe, we have to change it. 400 is not a HttpValidationProblemDetails but an ErrorResult. It is just an idea and a lead I don't know consequences.
What do you think about it @iammukeshm ?
Thanks
Hello all,
I'm facing the same issue. I tried to search by myself. When we have a validation error, if for exemple we try to add a product with an existing name, the error is managed by ExceptionMiddleware (FSH.WebApi) et it write the response with an object of type ErrorResult (FSH.WebApi).
The message arrived to blazor client. You can show it with DevTools with an error code 400.
But it is not displayed. We have "Something went wrong" !
If we take a look inside FSHApi.cs generated with NSwag, we can see that error 400 is not an ErrorResult but a HttpProblemValidationDetails that's why, I guess, like @kristian014 told us, ex.Result.Error is null !
I saw a file FSHApiConvention
I don't know, maybe, we have to change it. 400 is not a HttpValidationProblemDetails but an ErrorResult. It is just an idea and a lead I don't know consequences.
What do you think about it @iammukeshm ?
Thanks
I did communicate with @iammukeshm on linkedin regarding the above issue, and he told me that this issue and other issues will be resolved on the next update (.NET 8).
But for those of us who are already working on this version, If the above proposed solution can resolve the issue, I think it is better to try it out.
What do you think?
good news thanks ! I can wait the next version (.NET8) ! now I just try the solution to see if everything work correctly !
Did he told you when the next version will be available ?
He said the new version is almost completed! Didn't say when exactly. Did you try the solution to see if it works?
ok thank you ! no,sorry, it was just an idea, I don't master enought the code !