ankidroid / Anki-Android

AnkiDroid: Anki flashcards on Android. Your secret trick to achieve superhuman information retention.
GNU General Public License v3.0
7.93k stars 2.16k forks source link

fix(i18n): sync_translations PR creation is async, await it #16271

Closed mikehardy closed 2 weeks ago

mikehardy commented 2 weeks ago

Purpose / Description

we need to handle the asynchronous nature of the call that might throw an error, otherwise we can never actually catch the error if the PR already exists, and the workflow appears to fail even though it's fine

Fixes

No issue logged but this has been low-level bugging me forever, and I've been low-level looking at it periodically forever

Finally realized what the problem was

Apologies for just pasting a graphic in but this is what I'm trying to avoid / fix:

image

("Unhandled" because even though a try/catch should handle any thrown thing, it's async and the error isn't thrown until we're out of the try/catch scope 💡 ! )

Approach

Stew on it, then add an await to the call since it is async

How Has This Been Tested?

Testing shmesting who needs it (kidding, but can only test easily once it's merged and then we run sync translations script twice without merging in between...

Learning (optional, can help others)

How simple things can still take a while

Checklist

Please, go through these checks before submitting the PR.

mikehardy commented 2 weeks ago

(for the record I looked through the other workflows and they have await where I would expect it, seems it was just this one

mikehardy commented 2 weeks ago

rebased over main with windows flaky remediation