Replace try/catch with callback