Custom errors

Wanted to get some code written for #220