try-catching api