Skip to content

Commit

Permalink
language server checks
Browse files Browse the repository at this point in the history
  • Loading branch information
marenz2569 committed Jun 15, 2024
1 parent f0b5610 commit 1ad2fc7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions src/routes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ pub enum ServerError {
#[display(fmt = "Bad Request")]
BadClientData,

#[display(fmt = "Unauthorized")]
Unauthorized,

#[display(fmt = "Forbidden")]
Forbidden,

Expand All @@ -46,7 +43,6 @@ impl error::ResponseError for ServerError {
match *self {
ServerError::InternalError => StatusCode::INTERNAL_SERVER_ERROR,
ServerError::BadClientData => StatusCode::BAD_REQUEST,
ServerError::Unauthorized => StatusCode::UNAUTHORIZED,
ServerError::Forbidden => StatusCode::FORBIDDEN,
ServerError::Conflict => StatusCode::CONFLICT,
}
Expand Down
26 changes: 14 additions & 12 deletions src/routes/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,9 @@ pub async fn submit_gps_live(

use tlms::grpc::chemo_client::ChemoClient;

let grpc_host = match std::env::var("CHEMO_GRPC") {
let grpc_host = match std::env::var("CHEMO_GRPC") {
Ok(value) => value,
Err(e) => {
Err(_e) => {
error!("NO grpc specified");
return Err(ServerError::InternalError);
}
Expand Down Expand Up @@ -453,16 +453,18 @@ pub async fn travel_file_upload(
lon: point.point().x(), // ambiguous for coordinates on a map
elevation: point.elevation,
timestamp: match point.time {
Some(time) => match chrono::naive::NaiveDateTime::parse_from_str(
&time.format().unwrap(),
"%Y-%m-%dT%H:%M:%S.%fZ",
) {
Ok(result) => result,
Err(e) => {
error!("cannot parse timestamp {e}");
return Err(ServerError::BadClientData);
Some(time) => {
match chrono::naive::NaiveDateTime::parse_from_str(
&time.format().unwrap(),
"%Y-%m-%dT%H:%M:%S.%fZ",
) {
Ok(result) => result,
Err(e) => {
error!("cannot parse timestamp {e}");
return Err(ServerError::BadClientData);
}
}
},
}
None => break,
},

Expand All @@ -476,7 +478,7 @@ pub async fn travel_file_upload(
}
}
}
},
}
Err(e) => {
error!("cannot convert multipart string into gpx {:?}", e);
return Err(ServerError::BadClientData);
Expand Down

0 comments on commit 1ad2fc7

Please sign in to comment.