Jump to content

Example IHasResultFactory


rechigo

Recommended Posts

rechigo

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

rechigo

what response code?

I am trying to return a 400 response

 

Sent from my SM-G973U using Tapatalk

Edited by rechigo
Link to comment
Share on other sites

rechigo

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...