chore: notes on fixmes to improve error handling
Some checks failed
Test / build (map[name:nightly]) (push) Successful in 6m51s
Test / build (map[name:stable]) (push) Successful in 6m33s
Release Please / Release-plz (push) Failing after 50s

This commit is contained in:
Paul Campbell 2024-12-23 09:44:02 +00:00
parent 651bd656c2
commit d96dee302d
5 changed files with 16 additions and 16 deletions

View file

@ -53,9 +53,9 @@ impl Actor for ImportAttachmentActor {
// - - - download the attachment from trello
let dir_path = this.ctx.temp_fs.base().join(&*this.trello_attachment.id);
let dir = this.ctx.temp_fs.dir(&dir_path);
dir.create()?;
dir.create()?; // FIXME: (#6) handle error
let file_path = dir_path.join(&*this.trello_attachment.name);
ask!(this.rate_limit_actor, RequestToken)?;
ask!(this.rate_limit_actor, RequestToken)?; // FIXME: (#6) handle error
let attachment_path = this
.ctx
.trello_client()
@ -66,7 +66,7 @@ impl Actor for ImportAttachmentActor {
&this.ctx.temp_fs,
)
.await
.with_context(|| f!("saving attachment {}", file_path.display()))?;
.with_context(|| f!("saving attachment {}", file_path.display()))?; // FIXME: (#6) handle error
let attachment_file = this.ctx.temp_fs.file(&attachment_path);
// - - - upload the attachment to nextcloud card
let attachment = this
@ -88,7 +88,7 @@ impl Actor for ImportAttachmentActor {
e.to_string()
);
})
.with_context(|| f!("adding attachment to card {}", file_path.display()))?;
.with_context(|| f!("adding attachment to card {}", file_path.display()))?; // FIXME: (#6) handle error
p!(
this.ctx.prt,
">> Attachment added: {}:{}",
@ -99,9 +99,9 @@ impl Actor for ImportAttachmentActor {
// delete local copy of attachment
attachment_file
.remove()
.with_context(|| f!("deleting temp file {attachment_file}"))?;
.with_context(|| f!("deleting temp file {attachment_file}"))?; // FIXME: (#6) handle error
dir.remove()
.with_context(|| f!("deleting temp dir {dir}"))?;
.with_context(|| f!("deleting temp dir {dir}"))?; // FIXME: (#6) handle error
Ok(actor_ref.stop_gracefully().await?)
});

View file

@ -81,7 +81,7 @@ impl Actor for ImportCardActor {
desc.as_ref(),
)
.await
.result?;
.result?; // FIXME: (#6) handle error
let mut limit = RateLimit::new("labels & attachments", 10, 10.0, this.ctx.now());

View file

@ -47,8 +47,8 @@ impl Actor for ImportLabelActor {
trello_name: this.trello_label.name.clone(),
trello_color: this.trello_label.color.clone()
}
)?;
// - - - add the label to the nextcloud card
)?; // FIXME: (#6) handle error
// - - - add the label to the nextcloud card
this.ctx
.deck_client()
.add_label_to_card(
@ -58,7 +58,7 @@ impl Actor for ImportLabelActor {
label_id,
)
.await
.result?;
.result?; // FIXME: (#6) handle error
Ok(actor_ref.stop_gracefully().await?)
});

View file

@ -62,7 +62,7 @@ impl Actor for ImportStackActor {
crate::p!(this.ctx.prt, "Importing stack: {}", this.trello_stack.name);
// - get the list of trello cards in the stack
ask!(this.rate_limit_actor, RequestToken)?;
ask!(this.rate_limit_actor, RequestToken)?; // FIXME: (#6) handle error
let mut trello_cards = trello_client
.list_cards(&TrelloListId::new(this.trello_stack.id.as_ref()))
.await
@ -75,7 +75,7 @@ impl Actor for ImportStackActor {
// - for each card in the trello stack
for trello_card in trello_cards.into_iter() {
limit.block_until_token_available(this.ctx.now()).await;
ask!(this.rate_limit_actor, RequestToken)?;
ask!(this.rate_limit_actor, RequestToken)?; // FIXME: (#6) handle error
let trello_card_name = trello_card.name.clone();
let child: ActorRef<ImportCardActor> = spawn_in_thread!(
actor_ref.clone(),

View file

@ -33,9 +33,9 @@ async fn create_any_missing_stacks(
let missing_stacks = selected_trello_stacks
.iter()
.filter(|trello_stack| {
!nextcloud_stacks
.iter()
.any(|nextcloud_stack| nextcloud_stack.title.deref() == trello_stack.name.deref())
!nextcloud_stacks.iter().any(|nextcloud_stack|
// FIXME: (#7) nextcloud title is limited to 100 characters
nextcloud_stack.title.deref() == trello_stack.name.deref())
})
.cloned()
.collect::<Vec<_>>();
@ -55,7 +55,7 @@ async fn create_any_missing_stacks(
let stack = deck_client
.create_stack(
nextcloud_board_id,
(&missing_stack.name).into(),
(&missing_stack.name).into(), // FIXME: (#7) limited to 100 characters
(&missing_stack.pos).into(),
)
.await