mirror of
https://github.com/YGGverse/nexy.git
synced 2026-03-31 09:15:28 +00:00
rename string member to message
This commit is contained in:
parent
01c4eec592
commit
c3f701bc6a
3 changed files with 20 additions and 12 deletions
|
|
@ -8,12 +8,12 @@ pub enum Response<'a> {
|
||||||
query: &'a str,
|
query: &'a str,
|
||||||
},
|
},
|
||||||
InternalServerError {
|
InternalServerError {
|
||||||
error: String,
|
message: String,
|
||||||
path: Option<PathBuf>,
|
path: Option<PathBuf>,
|
||||||
query: Option<&'a str>,
|
query: Option<&'a str>,
|
||||||
},
|
},
|
||||||
NotFound {
|
NotFound {
|
||||||
error: String,
|
message: String,
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
query: &'a str,
|
query: &'a str,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ impl Connection {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(e) => match self.response(Response::InternalServerError {
|
Err(e) => match self.response(Response::InternalServerError {
|
||||||
error: format!(
|
message: format!(
|
||||||
"[{}] < [{}] failed to handle incoming request: `{e}`",
|
"[{}] < [{}] failed to handle incoming request: `{e}`",
|
||||||
self.address.server, self.address.client
|
self.address.server, self.address.client
|
||||||
),
|
),
|
||||||
|
|
@ -135,9 +135,13 @@ impl Connection {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Response::InternalServerError { error, path, query } => {
|
Response::InternalServerError {
|
||||||
|
message,
|
||||||
|
path,
|
||||||
|
query,
|
||||||
|
} => {
|
||||||
eprintln!(
|
eprintln!(
|
||||||
"[{}] > [{}] `{query:?}` (`{:?}`): internal server error: `{error}`",
|
"[{}] > [{}] `{query:?}` (`{:?}`): internal server error: `{message}`",
|
||||||
self.address.server,
|
self.address.server,
|
||||||
self.address.client,
|
self.address.client,
|
||||||
path.map(|p| p.to_string_lossy().to_string()),
|
path.map(|p| p.to_string_lossy().to_string()),
|
||||||
|
|
@ -158,9 +162,13 @@ impl Connection {
|
||||||
);
|
);
|
||||||
self.session.template.access_denied()
|
self.session.template.access_denied()
|
||||||
}
|
}
|
||||||
Response::NotFound { error, path, query } => {
|
Response::NotFound {
|
||||||
|
message,
|
||||||
|
path,
|
||||||
|
query,
|
||||||
|
} => {
|
||||||
eprintln!(
|
eprintln!(
|
||||||
"[{}] < [{}] not found: `{query}` (`{}`) reason: {error}",
|
"[{}] < [{}] not found: `{query}` (`{}`) reason: {message}",
|
||||||
self.address.server,
|
self.address.server,
|
||||||
self.address.client,
|
self.address.client,
|
||||||
path.to_string_lossy()
|
path.to_string_lossy()
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ impl Public {
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
return callback(Response::NotFound {
|
return callback(Response::NotFound {
|
||||||
error: e.to_string(),
|
message: e.to_string(),
|
||||||
path,
|
path,
|
||||||
query,
|
query,
|
||||||
});
|
});
|
||||||
|
|
@ -76,7 +76,7 @@ impl Public {
|
||||||
is_root: path == self.public_dir,
|
is_root: path == self.public_dir,
|
||||||
},
|
},
|
||||||
Err(e) => Response::InternalServerError {
|
Err(e) => Response::InternalServerError {
|
||||||
error: e.to_string(),
|
message: e.to_string(),
|
||||||
path: Some(path),
|
path: Some(path),
|
||||||
query: Some(query),
|
query: Some(query),
|
||||||
},
|
},
|
||||||
|
|
@ -93,7 +93,7 @@ impl Public {
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
return callback(Response::InternalServerError {
|
return callback(Response::InternalServerError {
|
||||||
error: format!("failed to read response chunk: `{e}`"),
|
message: format!("failed to read response chunk: `{e}`"),
|
||||||
path: Some(path),
|
path: Some(path),
|
||||||
query: Some(query),
|
query: Some(query),
|
||||||
});
|
});
|
||||||
|
|
@ -101,7 +101,7 @@ impl Public {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Err(e) => callback(Response::InternalServerError {
|
Err(e) => callback(Response::InternalServerError {
|
||||||
error: format!("failed to read response: `{e}`"),
|
message: format!("failed to read response: `{e}`"),
|
||||||
path: Some(path),
|
path: Some(path),
|
||||||
query: Some(query),
|
query: Some(query),
|
||||||
}),
|
}),
|
||||||
|
|
@ -109,7 +109,7 @@ impl Public {
|
||||||
_ => panic!(), // unexpected
|
_ => panic!(), // unexpected
|
||||||
},
|
},
|
||||||
Err(e) => callback(Response::InternalServerError {
|
Err(e) => callback(Response::InternalServerError {
|
||||||
error: format!("failed to read storage: `{e}`"),
|
message: format!("failed to read storage: `{e}`"),
|
||||||
path: Some(path),
|
path: Some(path),
|
||||||
query: Some(query),
|
query: Some(query),
|
||||||
}),
|
}),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue