Skip to content

Commit

Permalink
putGlyph no longer returns an optional error message
Browse files Browse the repository at this point in the history
  • Loading branch information
justvanrossum committed Dec 13, 2023
1 parent cb9db4d commit ec77c5a
Showing 1 changed file with 7 additions and 21 deletions.
28 changes: 7 additions & 21 deletions src/fontra/core/fonthandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,17 @@ async def processWrites(self) -> None:
self._writingInProgressEvent.set()

async def _processWritesOneCycle(self) -> None:
writeFunc: Callable[
[], Awaitable[None]
] # inferencing with partial() goes wrong
while self._dataScheduledForWriting:
writeKey, (writeFunc, connection) = popFirstItem(
self._dataScheduledForWriting
)
reloadPattern = _writeKeyToPattern(writeKey)
logger.info(f"write {writeKey} to backend")
try:
errorMessage = await writeFunc()
await writeFunc()
except Exception as e:
logger.error("exception while writing data: %r", e)
traceback.print_exc()
Expand All @@ -132,25 +135,6 @@ async def _processWritesOneCycle(self) -> None:
else:
# No connection to inform, let's error
raise
else:
if errorMessage:
messageDetail = f"The edit has been reverted.\n\n{errorMessage}"
try:
await self.reloadData(reloadPattern)
except Exception as e:
messageDetail = (
f"{errorMessage}\n\n"
"The edit could not be reverted due to an additional error."
f"\n\n{e!r}"
)
if connection is not None:
await connection.proxy.messageFromServer(
"The data could not be saved.",
messageDetail,
)
else:
# This ideally can't happen
assert False, errorMessage
await asyncio.sleep(0)

@asynccontextmanager
Expand Down Expand Up @@ -360,7 +344,9 @@ async def _prepareRootObject(self, change):
async def _updateLocalData(
self, rootKeys, rootObject, sourceConnection, writeToBackEnd
) -> None:
writeFunc: Callable[[], Awaitable] # inferencing with partial() goes wrong
writeFunc: Callable[
[], Awaitable[None]
] # inferencing with partial() goes wrong
for rootKey in rootKeys + sorted(rootObject._assignedAttributeNames):
if rootKey == "glyphs":
glyphSet = rootObject.glyphs
Expand Down

0 comments on commit ec77c5a

Please sign in to comment.