fix compile error, catch error using try-catch.