public static string SelectMessage(RequestFailReason failReason) { switch (failReason) { case RequestFailReason.Timeout: return("The remote server did not respond in a timely fashion, aborting story request."); case RequestFailReason.UnexpectedResponseStatusCode: return ("The remote server hosting the story chapter you requested did not respond with an expected status code."); case RequestFailReason.UnexpectedResponseContent: return ("Sorry, even though the remote server always responds with an OK status, the content received doesn't look like a story."); case RequestFailReason.Unknown: return("A failure reason code was not provided, thus the reason is unknown"); default: return ($"The code provided: {failReason} does not have a standard response message defined"); // In case new reasons are added but not implemented } }
public StoryProviderException(RequestFailReason failReason, StoryProvider storyProvider, Exception innerException) : base(SelectMessage(failReason), innerException) { FailureReasonCode = failReason; StoryProvider = storyProvider; }
public StoryProviderException(RequestFailReason failReason) : base(SelectMessage(failReason)) { FailureReasonCode = failReason; }