Added the exit 1 when error occurs

Signed-off-by: Zhenfang Wei <zhenfang.wei@ericsson.com>