handle with exceptions and exit value

Signed-off-by: yuanhuan <yuanhuan@tcl.com>