server custom error is changed
This commit is contained in:
parent
86209964ad
commit
fb1b451959
|
@ -98,7 +98,9 @@ impl Service {
|
||||||
|
|
||||||
let conn = self.pool.get().map_err(|e| {
|
let conn = self.pool.get().map_err(|e| {
|
||||||
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||||
|
code: bpr::protobuf::rpc::Error::SERVER_00,
|
||||||
message: format!("server {}", e),
|
message: format!("server {}", e),
|
||||||
|
data: None,
|
||||||
})
|
})
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
@ -107,7 +109,9 @@ impl Service {
|
||||||
.select_by_username(&conn, &req.username)
|
.select_by_username(&conn, &req.username)
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||||
|
code: bpr::protobuf::rpc::Error::SERVER_00,
|
||||||
message: format!("server {}", e),
|
message: format!("server {}", e),
|
||||||
|
data: None,
|
||||||
})
|
})
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
@ -126,7 +130,9 @@ impl Service {
|
||||||
.await
|
.await
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||||
message: format!("server: {}", e),
|
code: bpr::protobuf::rpc::Error::SERVER_00,
|
||||||
|
message: format!("server {}", e),
|
||||||
|
data: None,
|
||||||
})
|
})
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
@ -189,7 +195,9 @@ impl Service {
|
||||||
|
|
||||||
let conn = self.pool.get().map_err(|e| {
|
let conn = self.pool.get().map_err(|e| {
|
||||||
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||||
|
code: bpr::protobuf::rpc::Error::SERVER_00,
|
||||||
message: format!("server {}", e),
|
message: format!("server {}", e),
|
||||||
|
data: None,
|
||||||
})
|
})
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
@ -198,7 +206,9 @@ impl Service {
|
||||||
.select_by_nickname(&conn, &req.nickname)
|
.select_by_nickname(&conn, &req.nickname)
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||||
message: format!("server: {}", e),
|
code: bpr::protobuf::rpc::Error::SERVER_00,
|
||||||
|
message: format!("server {}", e),
|
||||||
|
data: None,
|
||||||
})
|
})
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
@ -217,7 +227,9 @@ impl Service {
|
||||||
.await
|
.await
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||||
message: format!("server: {}", e),
|
code: bpr::protobuf::rpc::Error::SERVER_00,
|
||||||
|
message: format!("server {}", e),
|
||||||
|
data: None,
|
||||||
})
|
})
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
@ -296,7 +308,9 @@ impl Service {
|
||||||
|
|
||||||
let conn = self.pool.get().map_err(|e| {
|
let conn = self.pool.get().map_err(|e| {
|
||||||
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||||
|
code: bpr::protobuf::rpc::Error::SERVER_00,
|
||||||
message: format!("server {}", e),
|
message: format!("server {}", e),
|
||||||
|
data: None,
|
||||||
})
|
})
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
@ -305,7 +319,9 @@ impl Service {
|
||||||
.select_by_url(&conn, &site_url)
|
.select_by_url(&conn, &site_url)
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||||
|
code: bpr::protobuf::rpc::Error::SERVER_00,
|
||||||
message: format!("server {}", e),
|
message: format!("server {}", e),
|
||||||
|
data: None,
|
||||||
})
|
})
|
||||||
})? {
|
})? {
|
||||||
Some(ms) => ms,
|
Some(ms) => ms,
|
||||||
|
@ -335,7 +351,9 @@ impl Service {
|
||||||
Some(s) => s,
|
Some(s) => s,
|
||||||
None => {
|
None => {
|
||||||
return Err(bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
return Err(bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||||
|
code: bpr::protobuf::rpc::Error::SERVER_00,
|
||||||
message: "captcha image encoding error[base64]".to_string(),
|
message: "captcha image encoding error[base64]".to_string(),
|
||||||
|
data: None,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -353,7 +371,9 @@ impl Service {
|
||||||
.insert(&conn, &new_captcha)
|
.insert(&conn, &new_captcha)
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||||
message: format!("server: {}", e),
|
code: bpr::protobuf::rpc::Error::SERVER_00,
|
||||||
|
message: format!("server {}", e),
|
||||||
|
data: None,
|
||||||
})
|
})
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
@ -371,7 +391,9 @@ impl Service {
|
||||||
.await
|
.await
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||||
message: format!("server: {}", e),
|
code: bpr::protobuf::rpc::Error::SERVER_00,
|
||||||
|
message: format!("server {}", e),
|
||||||
|
data: None,
|
||||||
})
|
})
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
@ -432,7 +454,9 @@ impl Service {
|
||||||
|
|
||||||
let conn = self.pool.get().map_err(|e| {
|
let conn = self.pool.get().map_err(|e| {
|
||||||
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||||
|
code: bpr::protobuf::rpc::Error::SERVER_00,
|
||||||
message: format!("server {}", e),
|
message: format!("server {}", e),
|
||||||
|
data: None,
|
||||||
})
|
})
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
@ -441,7 +465,9 @@ impl Service {
|
||||||
.select_by_url(&conn, client.site_url())
|
.select_by_url(&conn, client.site_url())
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||||
message: format!("server: {}", e),
|
code: bpr::protobuf::rpc::Error::SERVER_00,
|
||||||
|
message: format!("server {}", e),
|
||||||
|
data: None,
|
||||||
})
|
})
|
||||||
})? {
|
})? {
|
||||||
Some(ms) => ms,
|
Some(ms) => ms,
|
||||||
|
@ -482,7 +508,9 @@ impl Service {
|
||||||
.select(&conn, captcha_id)
|
.select(&conn, captcha_id)
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||||
message: format!("server: {}", e),
|
code: bpr::protobuf::rpc::Error::SERVER_00,
|
||||||
|
message: format!("server {}", e),
|
||||||
|
data: None,
|
||||||
})
|
})
|
||||||
})? {
|
})? {
|
||||||
Some(c) => c,
|
Some(c) => c,
|
||||||
|
@ -537,7 +565,9 @@ impl Service {
|
||||||
.select_by_username(&conn, &username)
|
.select_by_username(&conn, &username)
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||||
message: format!("server: {}", e),
|
code: bpr::protobuf::rpc::Error::SERVER_00,
|
||||||
|
message: format!("server {}", e),
|
||||||
|
data: None,
|
||||||
})
|
})
|
||||||
})? {
|
})? {
|
||||||
Some(m) => m,
|
Some(m) => m,
|
||||||
|
@ -611,7 +641,9 @@ impl Service {
|
||||||
)
|
)
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||||
message: format!("server: {}", e),
|
code: bpr::protobuf::rpc::Error::SERVER_00,
|
||||||
|
message: format!("server {}", e),
|
||||||
|
data: None,
|
||||||
})
|
})
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
@ -628,7 +660,9 @@ impl Service {
|
||||||
.await
|
.await
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
bcr::error::rpc::Error::Server(bcr::error::rpc::Server {
|
||||||
message: format!("server: {}", e),
|
code: bpr::protobuf::rpc::Error::SERVER_00,
|
||||||
|
message: format!("server {}", e),
|
||||||
|
data: None,
|
||||||
})
|
})
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user