Set correct scope when generating view cache for error