Added a custom error class and helpful error handling on model definition lines