Catch invalid URI
Catch invalid URI

If user is going directly to a page requiring authentication, e.g.
report editing page, there is no referrer and uri.parse will raise an
exception.

leonidas/qa-reports,leonidas/qa-reports,leonidas/qa-reports