centralize errors handling