systemprompt_runtime/
error.rs1use systemprompt_analytics::AnalyticsError;
14use systemprompt_config::{ConfigError as ProfileConfigError, ProfileBootstrapError};
15use systemprompt_database::RepositoryError;
16use systemprompt_extension::LoaderError;
17use systemprompt_files::FilesError;
18use systemprompt_models::errors::ConfigError as ModelConfigError;
19use systemprompt_models::paths::PathError;
20use systemprompt_users::UserError;
21use thiserror::Error;
22
23pub type RuntimeResult<T> = Result<T, RuntimeError>;
24
25#[derive(Debug, Error)]
26pub enum RuntimeError {
27 #[error(transparent)]
28 Profile(#[from] ProfileConfigError),
29
30 #[error(transparent)]
31 ProfileBootstrap(#[from] ProfileBootstrapError),
32
33 #[error(transparent)]
34 Config(#[from] ModelConfigError),
35
36 #[error(transparent)]
37 Paths(#[from] PathError),
38
39 #[error(transparent)]
40 Files(#[from] FilesError),
41
42 #[error(transparent)]
43 Users(#[from] UserError),
44
45 #[error(transparent)]
46 Repository(#[from] RepositoryError),
47
48 #[error(transparent)]
49 Analytics(#[from] AnalyticsError),
50
51 #[error(transparent)]
52 Loader(#[from] LoaderError),
53
54 #[error(
55 "Configured system admin '{username}' was not found in the users table. Run `systemprompt \
56 admin bootstrap` first."
57 )]
58 SystemAdminNotFound { username: String },
59
60 #[error(
61 "Configured system admin '{username}' exists but is not active. Re-activate the user \
62 before starting the platform."
63 )]
64 SystemAdminInactive { username: String },
65
66 #[error(
67 "Configured system admin '{username}' exists but does not carry the 'admin' role. Grant \
68 the role before starting the platform."
69 )]
70 SystemAdminMissingRole { username: String },
71
72 #[error("DATABASE_URL is empty")]
73 EmptyDatabaseUrl,
74
75 #[error("Database not found at '{path}'. Run setup first")]
76 DatabaseNotFound { path: String },
77
78 #[error("Database path '{path}' exists but is not a file")]
79 DatabaseNotFile { path: String },
80
81 #[error("internal: {0}")]
82 Internal(String),
83}