error handling in mapper