handle error and warnings