Refactor server error