Adds test for templateing on the onError-method
Adds more concise documentation for onError options, and adds more examples of usage.