Files
dioxus/packages/cli/src/error.rs
T
Jonathan Kelley ac3e33af46 cli json output, dx bundle fix, dx serve --platform android, race condition, drop ssg platform (#3186)
* clean up logging to avoid random extra trace

* fix race condition with updates

* properly wire up verbose

* fix bundling (macos) and logging

* Add structured output

* clean up clap names

* extract out wire format

* switch structured key to json

* fix random println, fallback to `dioxus/platform`

* clean up logging for run/build

* clean up logging around project

* remove manual exits

* fix tokio runtime for mobile

* rework dog app

* rip out ssg

* Switch dioxus/axum to dioxus/server

* add android template inline

* pre restructure for bundle prep

* add the whole res directory

* Better theme for the app

* remove mobile demo now that most apps work natively

* self-referential android

* only use deep linking for assets

* fix imports for android

* clippy, fixup ios and android

* I'm not boxing compiler message you can't make me

* fix clippy on unix
2024-11-12 09:01:01 -05:00

69 lines
1.5 KiB
Rust

use crate::metadata::CargoError;
use thiserror::Error as ThisError;
pub(crate) type Result<T, E = Error> = std::result::Result<T, E>;
#[derive(ThisError, Debug)]
pub(crate) enum Error {
/// Used when errors need to propagate but are too unique to be typed
#[error("{0}")]
Unique(String),
#[error("I/O Error: {0}")]
IO(#[from] std::io::Error),
#[error("Format Error: {0}")]
Format(#[from] std::fmt::Error),
#[error("Format failed: {0}")]
Parse(String),
#[error("Runtime Error: {0}")]
Runtime(String),
#[error("Cargo Error: {0}")]
Cargo(#[from] CargoError),
#[error("Invalid proxy URL: {0}")]
InvalidProxy(#[from] hyper::http::uri::InvalidUri),
#[error("Failed to establish proxy: {0}")]
ProxySetup(String),
#[error("Failed to bundle project: {0}")]
BundleFailed(#[from] tauri_bundler::Error),
#[error("Unsupported feature: {0}")]
UnsupportedFeature(String),
#[error("Failed to render template: {0}")]
TemplateParse(#[from] handlebars::RenderError),
#[error(transparent)]
Other(#[from] anyhow::Error),
}
impl From<&str> for Error {
fn from(s: &str) -> Self {
Error::Unique(s.to_string())
}
}
impl From<String> for Error {
fn from(s: String) -> Self {
Error::Unique(s)
}
}
impl From<html_parser::Error> for Error {
fn from(e: html_parser::Error) -> Self {
Self::Parse(e.to_string())
}
}
impl From<hyper::Error> for Error {
fn from(e: hyper::Error) -> Self {
Self::Runtime(e.to_string())
}
}