Skip to content

refactor(dgw): simplify aead error mapping in credential crypto#1693

Draft
Copilot wants to merge 2 commits intoDGW-326from
copilot/sub-pr-1689
Draft

refactor(dgw): simplify aead error mapping in credential crypto#1693
Copilot wants to merge 2 commits intoDGW-326from
copilot/sub-pr-1689

Conversation

Copy link
Contributor

Copilot AI commented Feb 26, 2026

aead::Error is a unit struct that does not implement std::error::Error, making .context() inapplicable. Simplifies the two AEAD error sites to drop the unused binding since the type carries no diagnostic information.

Changes:

  • encrypt / decrypt: map_err(|e| anyhow::anyhow!("...: {e}"))map_err(|_| anyhow::anyhow!("..."))
  • .context() is already used where applicable (e.g., String::from_utf8 on the decrypted bytes)
// Before
cipher.encrypt(&nonce, plaintext.as_bytes())
    .map_err(|e| anyhow::anyhow!("encryption failed: {e}"))?;

// After
cipher.encrypt(&nonce, plaintext.as_bytes())
    .map_err(|_| anyhow::anyhow!("encryption failed"))?;

Issue: #1689


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: CBenoit <3809077+CBenoit@users.noreply.github.com>
Copilot AI changed the title [WIP] Address feedback on using anyhow::Context for error handling refactor(dgw): simplify aead error mapping in credential crypto Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants