1

I read somewhere, that there is a possibility to log errors that happen, before your controller code gets executed. For example, if the parsing of a json post object fails, I would like to get some messages, so i know, where i can start fixing problems. Somebody said, it would be an option in Visual Studio, but i just can´t seem to find this post again.

For example, if i post a:

{
   "name":"bob"
   "lastName":"meier"
}

I would really like to get a output log like "Not able to parse json, because you missed a comma between the two attributes" or at least some kind of error message, so i know where to look. I just ran into this missed comma some times now and could never decide, if it was a wrong url, wrong DI or something entirely different, as the service just returns a 500, if something unexpected happens.

Does anybody has an idea how i could achieve this?

modmoto
  • 2,901
  • 7
  • 29
  • 54
  • 1
    You might start here https://stackoverflow.com/questions/21993758/asp-net-mvc-5-error-handling and https://learn.microsoft.com/en-us/aspnet/core/fundamentals/error-handling. Many of these techniques make use of [filters](https://msdn.microsoft.com/en-us/library/gg416513(VS.98).aspx). – Jasen Nov 22 '17 at 17:37
  • Ok thanks, that are some helpfull links to start researching =) – modmoto Dec 04 '17 at 11:58

0 Answers0