rechigo 293 Posted March 18, 2020 Share Posted March 18, 2020 I am trying to use result factory to throw a custom error and response code, but I can't figure out how to implement and use its methods... I tried various different things but my lack of c# knowledge didn't get me far.. If anyone could provide me a code snippet or github repository that implements this interface, that would be great. (Couldn't find any after looking for about half an hour) Sent from my SM-G973U using Tapatalk Link to comment Share on other sites More sharing options...
Luke 36881 Posted March 18, 2020 Share Posted March 18, 2020 what response code? Link to comment Share on other sites More sharing options...
rechigo 293 Posted March 18, 2020 Author Share Posted March 18, 2020 (edited) what response code?I am trying to return a 400 response Sent from my SM-G973U using Tapatalk Edited March 18, 2020 by rechigo Link to comment Share on other sites More sharing options...
Luke 36881 Posted March 18, 2020 Share Posted March 18, 2020 Just have your api method throw argumentexception and that will do it. Link to comment Share on other sites More sharing options...
rechigo 293 Posted March 18, 2020 Author Share Posted March 18, 2020 Just have your api method throw argumentexception and that will do it. This works fine, thanks! I was doing something similar earlier - by throwing the HttpRequestException, but that resulted in a 500 response so if anyone has this problem returning a 400 response, do throw new ArgumentException(); Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now