def write_file(self, path: Path, file: str):
        """Write the content of a file to a given path; raise a ToolError if an error occurs."""
        try:
            path.write_text(file)
        except Exception as e:
            raise ToolError(f"Ran into {e} while trying to write to {path}") from None
Write the content of a file to a given path; raise a ToolError if an error occurs.
src/upsonic/server/level_utilized/cu/edit.py