christophenne / trello2planka

MIT License
15 stars 1 forks source link

Should continue after an import problem ? #31

Open n9yty opened 8 months ago

n9yty commented 8 months ago

Trying to import with attachments but it dies at this point:

fetching attachment from Trello API, path = https://api.trello.com/1/cards/{redacted}/attachments/{redacted}/download/ status = 404 authenticated POST with file upload to https://{redacted}/api/cards/{redacted}/attachments Error: authenticated POST failed, status code = 422, code = E_UNPROCESSABLE_ENTITY, problems = undefined at authenticatedPostFileUpload (file:///home/ubuntu/trello2planka/src/planka/client.js:89:15)

It seems that it could catch errors like that and just ignore those attachments and keep going. I find it odd that the initial line for the download has no filename after it, it seems in the log the other ones do have one and maybe that is part of the problem?

christophenne commented 8 months ago

Hi, yes this seems something like #27 .

Good point, the whole tool lacks error recovery completely: In the importer there are lots of dependent calls to planka (like cards inside a list inside a board, etc.) where just ignoring an error didn't make a lot of sense to me, because most of the following calls would just fail anyway too. And then maybe the calls of the next undependent item wouldn't, and it would end up in a mess. (But granted, it also does if it panics right away.)

As for trello-fetched items, this might make less sense, I see the point.

However I won't be able to refactor anything in this tool any time soon. Of course for your case as a quickfix, if you don't care about these kind of attachments, you can wrap the call in a try/catch, which you probably already did anyway.