[web] improve error handling for pdf-caching GitOrigin-RevId: ddd65f2813fb08eb4493967071ee62d9742930cc