Update the MemoryBuffer API to use ErrorOr.