refactor error factory
- style
- more magic