more friendly error messages for permalinks

We should say things like "permalink code not found" or "permalink code not valid" when an invalid or missing permalink query is specified.