refactor __call__, keep exception handling generic