refactored error contexts