before (where have you been!) it is a powerful and simple way to log errors on your website – go use it, you’ll love it! What I hadn't considered before was that it could also log client side javascript errors . I picked up this tip from
.
The basic idea is to hook into the ‘window.onerror’ javascript event and to call a dedicated server side endpoint who’s responsible for logging the event in elmah.
In his course Craig sets this up with a web API end point but I’m going to use a MVC controller action method. The code here has 3 main parts:
https://gist.github.com/codescribler/6219683
To use this method you would simple post data that conforms the the ErrorInputModel to the address <site path>/error/record.
Again I have adapted craigs version as he chooses to use plain javascript where as i have opted to use jQuery ajax.
https://gist.github.com/codescribler/6219793
As you can see it simply builds up the error input model and posts it to the mvc action method.
I hope you find that useful.
A common issue I see is understanding the flow of commands, events and queries within a typical CQRS Event Sourcing based system. The following post is designed to clear up what happens at each step. Hopefully, this will help you to reason about your code and what each part does. What is CQRS and what
Read More
Making mistakes is part of programming. Spotting them early can save you time. I’ve started to notice a common set of ‘DDD Mistakes’ which many of us seem to make. And yes, I’ve made them all at some point in my career. This is by no means the definitive list – I’m sure there are
Read More