#![allow(clippy::tabs_in_doc_comments)]
#![allow(clippy::new_without_default)]
#![allow(clippy::wrong_self_convention)]
#![allow(clippy::type_complexity)]
#![allow(clippy::unit_cmp)]
#![allow(clippy::upper_case_acronyms)]
#[macro_use]
extern crate serde;
#[macro_use]
extern crate thiserror;
#[cfg(any(target_os = "macos", target_os = "ios"))]
#[macro_use]
extern crate objc;
use std::sync::mpsc::{RecvError, SendError};
pub use serde_json::Value;
use url::ParseError;
use crate::{
application::window::BadIcon,
http::{
header::{InvalidHeaderName, InvalidHeaderValue},
method::InvalidMethod,
status::InvalidStatusCode,
InvalidUri
}
};
pub mod application;
pub mod http;
pub mod webview;
pub type Result<T> = std::result::Result<T, Error>;
#[non_exhaustive]
#[derive(Error, Debug)]
pub enum Error {
#[cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd"))]
#[error(transparent)]
GlibError(#[from] glib::Error),
#[cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd"))]
#[error(transparent)]
GlibBoolError(#[from] glib::BoolError),
#[cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd"))]
#[error("Fail to fetch security manager")]
MissingManager,
#[error("Failed to initialize the script")]
InitScriptError,
#[error("Bad RPC request: {0} ((1))")]
RpcScriptError(String, String),
#[error(transparent)]
NulError(#[from] std::ffi::NulError),
#[error(transparent)]
OsError(#[from] crate::application::error::OsError),
#[error(transparent)]
ReceiverError(#[from] RecvError),
#[error(transparent)]
SenderError(#[from] SendError<String>),
#[error("Failed to send the message")]
MessageSender,
#[error(transparent)]
Json(#[from] serde_json::Error),
#[error(transparent)]
UrlError(#[from] ParseError),
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("Icon error: {0}")]
Icon(#[from] BadIcon),
#[cfg(target_os = "windows")]
#[error("WebView2 error: {0}")]
WebView2Error(webview2_com::Error),
#[error("Duplicate custom protocol registered: {0}")]
DuplicateCustomProtocol(String),
#[error("Invalid header name: {0}")]
InvalidHeaderName(#[from] InvalidHeaderName),
#[error("Invalid header value: {0}")]
InvalidHeaderValue(#[from] InvalidHeaderValue),
#[error("Invalid uri: {0}")]
InvalidUri(#[from] InvalidUri),
#[error("Invalid status code: {0}")]
InvalidStatusCode(#[from] InvalidStatusCode),
#[error("Invalid method: {0}")]
InvalidMethod(#[from] InvalidMethod),
#[error("Infallible error, something went really wrong: {0}")]
Infallible(#[from] std::convert::Infallible),
#[cfg(target_os = "android")]
#[error("JNI error: {0}")]
JNIError(#[from] jni::errors::Error)
}