I have created the functions to handle errors and warning