Make error messages more consistent and use raise more