Added err.c and err.h and implamented my error handeling function