qualia_core_db/q42/app_registry/
error.rs1use std::fmt;
4
5use crate::q42::app_manifest::AppManifestError;
6
7#[derive(Debug, Clone, PartialEq, Eq)]
9pub enum AppRegistryError {
10 RegistryFull,
12 RejectedMalformed,
14 MissingAppId,
16 Manifest(AppManifestError),
18}
19
20impl fmt::Display for AppRegistryError {
21 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
22 match self {
23 Self::RegistryFull => write!(f, "installed-app registry is full"),
24 Self::RejectedMalformed => {
25 write!(f, "malformed package rejected (identity not recoverable)")
26 }
27 Self::MissingAppId => write!(f, "app id is required"),
28 Self::Manifest(e) => write!(f, "manifest error: {e}"),
29 }
30 }
31}
32
33impl std::error::Error for AppRegistryError {
34 fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
35 match self {
36 Self::Manifest(e) => Some(e),
37 _ => None,
38 }
39 }
40}
41
42impl From<AppManifestError> for AppRegistryError {
43 fn from(value: AppManifestError) -> Self {
44 Self::Manifest(value)
45 }
46}