move error handle to process.c