Adding error checking on docViewer