Adds information to raised errors

Also adds an assert statement