♻️ (pagetop): initialize() devuelve Result sin panic

`Extension::initialize()` devuelve `Result<(), BoxError>`; `BoxError` es
un nuevo alias. Si una extensión falla, `prepare()` registra el error
con sus causas, vuelca las trazas, lo repite en stderr y termina con
código 1, sin panic! ni cambiar su firma.
This commit is contained in:
Manuel Cillero 2026-10-13 00:04:04 +02:00
parent 728a5c83dc
commit d3a9be7550
14 changed files with 199 additions and 110 deletions

View file

@ -3,7 +3,7 @@ use crate::core::extension::ExtensionRef;
use crate::core::theme::ThemeRef;
use crate::core::theme::all::register_theme;
use crate::web::Router;
use crate::{config, global, serve_static_files, trace, web};
use crate::{BoxError, config, global, serve_static_files, trace, web};
use std::sync::OnceLock;
@ -131,11 +131,15 @@ pub fn load_settings() {
// **< INICIALIZA LAS EXTENSIONES >*****************************************************************
pub async fn initialize_extensions() {
/// Inicializa las extensiones en el orden en que se registraron.
///
/// Se detiene en la primera que falle y devuelve su nombre corto junto con el error.
pub async fn initialize_extensions() -> Result<(), (&'static str, BoxError)> {
trace::info!("Calling application bootstrap");
for e in EXTENSIONS.get().into_iter().flatten() {
e.initialize().await;
e.initialize().await.map_err(|err| (e.short_name(), err))?;
}
Ok(())
}
// **< CONFIGURA LAS RUTAS >************************************************************************