CLI app for developers prototyping atproto functionality
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor(jwt): require explicit map_err for json encode paths

Drop the #[from] attribute on JsonEncode to require explicit map_err at
encode sites. This improves symmetry with JsonDecode, which is manually
mapped. Consistency in error handling patterns reduces cognitive load.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

authored by

Jack Grigg
Claude Haiku 4.5
and committed by
Tangled
8d117f82 289038f2

+3 -3
+3 -3
src/common/jwt.rs
··· 100 100 /// JSON serialization of header or claims failed (should not happen for 101 101 /// well-formed structs). 102 102 #[error("JSON encode failed")] 103 - JsonEncode(#[from] serde_json::Error), 103 + JsonEncode(serde_json::Error), 104 104 /// Signature was not exactly 64 bytes. 105 105 #[error("signature was {actual} bytes; expected 64")] 106 106 SignatureLength { ··· 131 131 claims: &JwtClaims, 132 132 signer: &AnySigningKey, 133 133 ) -> Result<String, JwtError> { 134 - let header_json = serde_json::to_vec(header)?; 135 - let claims_json = serde_json::to_vec(claims)?; 134 + let header_json = serde_json::to_vec(header).map_err(JwtError::JsonEncode)?; 135 + let claims_json = serde_json::to_vec(claims).map_err(JwtError::JsonEncode)?; 136 136 let header_b64 = URL_SAFE_NO_PAD.encode(&header_json); 137 137 let claims_b64 = URL_SAFE_NO_PAD.encode(&claims_json); 138 138 let signing_input = format!("{header_b64}.{claims_b64}");