whats the best practice to deal with potential errors in the application