Created
March 30, 2020 13:26
-
-
Save brianhdk/4be4ea03f7453744584fc7b7e381734e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| string body = await httpRequest.Read(logger); | |
| T request; | |
| try | |
| { | |
| request = JsonConvert.DeserializeObject<T>(body); | |
| } | |
| catch (JsonException ex) | |
| { | |
| logger.LogError(ex, "BadRequest with message: Error parsing body ({Message}) {Body}", ex.Message, body.MaxLengthWithDots(3000)); | |
| return new BadRequestErrorMessageResult($"Request is invalid. Error parsing body as JSON: {ex.Message}."); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment