Skip to main content

Module error

Module error 

Source
Expand description

Application-level error type.

AppError is the typed error used across all use cases and handlers, replacing the legacy Result<_, String> pattern (cf. issues #425, #427).

Migration started in story AUTH-001 (auth_use_cases.rs).

§Design

  • thiserror for ergonomic error definitions.
  • actix_web::ResponseError impl maps each variant to the right HTTP status.
  • From<String> is intentionally provided as a transition convenience for repositories still returning Result<_, String>. Variants should be used directly when a specific error semantic applies.

§Anti-patterns explicitly avoided

  • Leaking sensitive data in error messages exposed to clients (DB connection strings, internal IPs, stack traces). The error_response() body returns a structured payload; redaction policy will be enforced in a follow-up RFC (see #429 §6 and astro-svelte-expert.memory.md).
  • Returning generic Internal for everything (defeats the purpose of typed errors and HTTP status discrimination).

Enums§

AppError
Application-level error.

Constants§

MOTIF_MODERATION_REQUIS
Refus opposé à une modération communautaire (SEL/Poll/Notice/SharedObject) tentée sans motif texte.
REFUS_ON_BEHALF_RESERVE_AUX_SYNDICS
Story #588 (INV-5/FR27) — refus opposé à un copropriétaire (ou tout compte non-syndic) qui tente de positionner on_behalf_of_acp = true sur une réservation. Contient volontairement la sous-chaîne « réservée aux » déjà reconnue par classification_erreurs::est_interdit (403), pour ne pas dupliquer le lexique bilingue — même raisonnement que REFUS_RESERVE_AUX_COPROPRIETAIRES.
REFUS_RESERVE_AUX_COPROPRIETAIRES
Refus opposé à qui n’a pas de fiche de copropriétaire, sur les modules communautaires qui engagent une personne : offre de compétence, prêt d’objet, réservation de ressource.
REFUS_VOTE_RESERVE_AUX_COPROPRIETAIRES
Refus opposé à qui n’a pas de fiche de copropriétaire et tente de voter à une consultation (Poll). Même famille que REFUS_RESERVE_AUX_COPROPRIETAIRES mais un module séparé : voter engage un avis personnel, la constante et le message diffèrent donc légèrement (repris du message déjà affiché côté handler avant Story 5.3 #587, pour n’avoir plus qu’une seule source).