mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
wip: more meaningful error handling
This commit is contained in:
parent
fc038dbd97
commit
573534a9a6
2 changed files with 22 additions and 1 deletions
|
|
@ -2,6 +2,27 @@ use crate::*;
|
||||||
pub(crate) use std::fmt::Write;
|
pub(crate) use std::fmt::Write;
|
||||||
pub(crate) use ::tengri::tui::ratatui::prelude::Position;
|
pub(crate) use ::tengri::tui::ratatui::prelude::Position;
|
||||||
|
|
||||||
|
impl App {
|
||||||
|
pub fn view (&self) -> impl Content<TuiOut> + '_ {
|
||||||
|
let view: Perhaps<RenderBox<TuiOut>> =
|
||||||
|
FromDsl::take_from(self, &mut self.config.view.clone());
|
||||||
|
self.size.of(lay! {
|
||||||
|
When(matches!(&view, Ok(None)), Fill::y(Bsp::s(
|
||||||
|
Fixed::y(1, "no view"),
|
||||||
|
Fill::y(format!("{:?}", &self.config.view)),
|
||||||
|
))),
|
||||||
|
When(matches!(&view, Err(_)), Fill::y(Bsp::s(
|
||||||
|
Fixed::y(1, "view error"),
|
||||||
|
Fill::y(Bsp::s(
|
||||||
|
view.as_ref().err().map(|e|format!("{e}")),
|
||||||
|
format!("{:?}", &self.config.view),
|
||||||
|
))
|
||||||
|
))),
|
||||||
|
When(matches!(&view, Ok(Some(_))), Fill::y(view)),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[tengri_proc::view(TuiOut)]
|
#[tengri_proc::view(TuiOut)]
|
||||||
impl App {
|
impl App {
|
||||||
pub fn view_nil (&self) -> impl Content<TuiOut> + use<'_> {
|
pub fn view_nil (&self) -> impl Content<TuiOut> + use<'_> {
|
||||||
|
|
|
||||||
2
deps/tengri
vendored
2
deps/tengri
vendored
|
|
@ -1 +1 @@
|
||||||
Subproject commit 90f5699fff48d2e8e0a24c36741a7d4ff771385d
|
Subproject commit f08593f0f8c3dc03a734d922d2442848a4205ad6
|
||||||
Loading…
Add table
Add a link
Reference in a new issue