private static string getDefaultmsg(errorEnum code) { switch (code) { case errorEnum.e_badRequest: return("Object is invalid, please check you have populated all required properties and try again."); case errorEnum.e_notFound: return("Object was not found."); case errorEnum.e_notAllowed: return("Method not allowed."); case errorEnum.e_internalError: return("Internal server error occured"); case errorEnum.e_unauthorize: return("Unauthorized to perform this action."); default: return("Error not specified"); } }
private static string getContent(errorEnum code) { switch (code) { case errorEnum.e_badRequest: return("Bad Request Received"); case errorEnum.e_notFound: return("Not Found"); case errorEnum.e_notAllowed: return("Method Not Allowed."); case errorEnum.e_internalError: return("Internal Server Error Occured"); case errorEnum.e_unauthorize: return("Unauthorized"); default: return("Error not specified"); } }
public Error(errorEnum c) { this.Code = (int)c; this.Message = getDefaultmsg(c); this.Content = getContent(c); }
public Error(errorEnum c, string msg) { this.Code = (int)c; this.Message = msg; this.Content = getContent(c); }