Remove old thiserror
This commit is contained in:
@@ -10,6 +10,3 @@ debug-assertions = false
|
||||
lto = "thin"
|
||||
codegen-units = 64
|
||||
incremental = true
|
||||
|
||||
[patch.crates-io]
|
||||
thiserror = { git = "https://github.com/dominikwerder/thiserror.git", branch = "cstm" }
|
||||
|
||||
+6
-8
@@ -1,8 +1,6 @@
|
||||
use err::thiserror;
|
||||
use err::ThisError;
|
||||
|
||||
#[derive(Debug, ThisError)]
|
||||
#[cstm(name = "Postgres")]
|
||||
pub enum Error {
|
||||
Postgres(#[from] tokio_postgres::Error),
|
||||
}
|
||||
autoerr::create_error_v1!(
|
||||
name(Error, "Postgres"),
|
||||
enum variants {
|
||||
Postgres(#[from] tokio_postgres::Error),
|
||||
},
|
||||
);
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
use crate::conn::PgClient;
|
||||
use err::thiserror;
|
||||
use err::ThisError;
|
||||
use log::*;
|
||||
use std::net::SocketAddrV4;
|
||||
|
||||
#[derive(Debug, ThisError)]
|
||||
#[cstm(name = "PgFindAddr")]
|
||||
pub enum Error {
|
||||
Postgres(#[from] tokio_postgres::Error),
|
||||
IocAddrNotFound,
|
||||
}
|
||||
autoerr::create_error_v1!(
|
||||
name(Error, "PgFindAddr"),
|
||||
enum variants {
|
||||
Postgres(#[from] tokio_postgres::Error),
|
||||
IocAddrNotFound,
|
||||
},
|
||||
);
|
||||
|
||||
#[allow(unused)]
|
||||
async fn __find_channel_addr(backend: &str, name: String, pg: &PgClient) -> Result<Option<SocketAddrV4>, Error> {
|
||||
|
||||
+9
-10
@@ -3,19 +3,18 @@ use async_channel::Receiver;
|
||||
use async_channel::RecvError;
|
||||
use async_channel::SendError;
|
||||
use async_channel::Sender;
|
||||
use err::thiserror;
|
||||
use err::ThisError;
|
||||
use log::*;
|
||||
use netpod::Database;
|
||||
|
||||
#[derive(Debug, ThisError)]
|
||||
#[cstm(name = "PgPool")]
|
||||
pub enum Error {
|
||||
Postgres(#[from] tokio_postgres::Error),
|
||||
EndOfPool,
|
||||
ChannelRecv(#[from] RecvError),
|
||||
ChannelSend,
|
||||
}
|
||||
autoerr::create_error_v1!(
|
||||
name(Error, "PgPool"),
|
||||
enum variants {
|
||||
Postgres(#[from] tokio_postgres::Error),
|
||||
EndOfPool,
|
||||
ChannelRecv(#[from] RecvError),
|
||||
ChannelSend,
|
||||
},
|
||||
);
|
||||
|
||||
impl From<crate::err::Error> for Error {
|
||||
fn from(value: crate::err::Error) -> Self {
|
||||
|
||||
+7
-8
@@ -1,14 +1,13 @@
|
||||
use crate::conn::PgClient;
|
||||
use err::thiserror;
|
||||
use err::ThisError;
|
||||
use log::*;
|
||||
|
||||
#[derive(Debug, ThisError)]
|
||||
#[cstm(name = "PgSchema")]
|
||||
pub enum Error {
|
||||
Postgres(#[from] tokio_postgres::Error),
|
||||
LogicError(String),
|
||||
}
|
||||
autoerr::create_error_v1!(
|
||||
name(Error, "PgSchema"),
|
||||
enum variants {
|
||||
Postgres(#[from] tokio_postgres::Error),
|
||||
LogicError(String),
|
||||
},
|
||||
);
|
||||
|
||||
impl Error {
|
||||
pub fn from_logic_msg<T>(msg: T) -> Self
|
||||
|
||||
+13
-18
@@ -3,8 +3,6 @@ use async_channel::Sender;
|
||||
use chrono::DateTime;
|
||||
use chrono::Utc;
|
||||
use core::fmt;
|
||||
use err::ThisError;
|
||||
use err::thiserror;
|
||||
use futures_util::Future;
|
||||
use futures_util::TryFutureExt;
|
||||
use log::*;
|
||||
@@ -16,7 +14,6 @@ use netpod::Shape;
|
||||
use serde::Serialize;
|
||||
use series::SeriesId;
|
||||
use std::pin::Pin;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
use std::time::Instant;
|
||||
use taskrun::tokio;
|
||||
@@ -42,21 +39,19 @@ macro_rules! trace3 {
|
||||
};
|
||||
}
|
||||
|
||||
#[derive(Debug, ThisError)]
|
||||
#[cstm(name = "PgSeries")]
|
||||
pub enum Error {
|
||||
Postgres(#[from] tokio_postgres::Error),
|
||||
CreateSeriesFail,
|
||||
SeriesMissing,
|
||||
ChannelError,
|
||||
#[error("DbConsistencySeries({0})")]
|
||||
DbConsistencySeries(String),
|
||||
#[error("ScalarType({0})")]
|
||||
ScalarType(i32),
|
||||
Shape,
|
||||
#[error("SeriesKind({0})")]
|
||||
SeriesKind(i16),
|
||||
}
|
||||
autoerr::create_error_v1!(
|
||||
name(Error, "PgSeries"),
|
||||
enum variants {
|
||||
Postgres(#[from] tokio_postgres::Error),
|
||||
CreateSeriesFail,
|
||||
SeriesMissing,
|
||||
ChannelError,
|
||||
DbConsistencySeries(String),
|
||||
ScalarType(i32),
|
||||
Shape,
|
||||
SeriesKind(i16),
|
||||
},
|
||||
);
|
||||
|
||||
impl From<crate::err::Error> for Error {
|
||||
fn from(value: crate::err::Error) -> Self {
|
||||
|
||||
+7
-8
@@ -1,5 +1,3 @@
|
||||
use err::thiserror;
|
||||
use err::ThisError;
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Debug)]
|
||||
@@ -15,12 +13,13 @@ impl fmt::Display for TestError {
|
||||
|
||||
impl std::error::Error for TestError {}
|
||||
|
||||
#[derive(Debug, ThisError)]
|
||||
#[cstm(name = "PgTestErr")]
|
||||
enum Error {
|
||||
Postgres(#[from] tokio_postgres::Error),
|
||||
Dummy(#[from] TestError),
|
||||
}
|
||||
autoerr::create_error_v1!(
|
||||
name(Error, "PgTestErr"),
|
||||
enum variants {
|
||||
Postgres(#[from] tokio_postgres::Error),
|
||||
Dummy(#[from] TestError),
|
||||
},
|
||||
);
|
||||
|
||||
#[test]
|
||||
fn err_msg_01() {
|
||||
|
||||
Reference in New Issue
Block a user