Fix the wrong error location catch in the Api invoke

Signed-off-by: Richard Lea <chigix@zoho.com>