Refactor API callable to catch exceptions