Handle exceptions in getpage method