Add a variable to keep trace of last error encountred. This to help diagnose the error and give an acces to error