Improved raised errors so error messages are included