add throw_exception and some help functions of arguments checking in error.c