Is it acceptable to use Http status codes (.NET HttpStatusCode enum) in my application instead of creating a new enum ?
I encoutered an issue (design issue?) in my API, for example in the authentication process, I had this method signature:
public bool authenticate(string token)
Leaving me with a Yes/No possibility, where I needed, in the end a Maybe case (But that's unecessary details), so I decided to create a new object with an HttpStatusCode and a string to describe the reason for the status, instead of creating/maintaining a new error code enum
public class ReturnCode {
public HttpStatusCode code;
public string reason;
}
Then the status helped me handling 401 and 403's like differences.
I get it might be a duplicate of : Should I use HTTP status codes to describe application level events
But I don't think the protocol part of the answer is of my concerns as I might not even return (the same) errors to the website (Or maybe I don't understand the answer as I'm not native english speaker).