Throw error when accessing non-existing users

When requesting html, an error is displayed when a user does not exist. When requesting json, an error code of 404 is returned.