add handler.c to handle error