Skip to content

Commit 11387cc

Browse files
committed
[#181] 오류 메세지 수정
1 parent 3ca3f83 commit 11387cc

1 file changed

Lines changed: 9 additions & 14 deletions

File tree

src/engine/actions/ddl/alter_database.rs

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ use crate::engine::schema::database::DatabaseSchema;
88
use crate::engine::types::{
99
ExecuteColumn, ExecuteColumnType, ExecuteField, ExecuteResult, ExecuteRow,
1010
};
11-
use crate::errors::execute_error::ExecuteError;
1211
use crate::errors;
12+
use crate::errors::execute_error::ExecuteError;
1313

1414
impl DBEngine {
1515
pub async fn alter_database(&self, query: AlterDatabaseQuery) -> errors::Result<ExecuteResult> {
@@ -22,9 +22,10 @@ impl DBEngine {
2222
Some(action) => match action {
2323
AlterDatabaseAction::RenameTo(rename) => {
2424
// 기존 데이터베이스명
25-
let from_database_name = query.database_name.clone().ok_or_else(|| {
26-
ExecuteError::wrap("no database name".to_string())
27-
})?;
25+
let from_database_name = query
26+
.database_name
27+
.clone()
28+
.ok_or_else(|| ExecuteError::wrap("no database name".to_string()))?;
2829

2930
// 변경할 데이터베이스명
3031
let to_database_name = rename.name;
@@ -42,9 +43,7 @@ impl DBEngine {
4243
if let Err(error) = result {
4344
match error.kind() {
4445
IOErrorKind::NotFound => {
45-
return Err(ExecuteError::wrap(
46-
"database not found".to_string(),
47-
));
46+
return Err(ExecuteError::wrap("database not found".to_string()));
4847
}
4948
_ => {
5049
return Err(ExecuteError::wrap(
@@ -73,22 +72,18 @@ impl DBEngine {
7372
.await
7473
{
7574
return Err(ExecuteError::wrap(
76-
"no database name".to_string(),
75+
"failed to write database config",
7776
));
7877
}
7978
}
8079
None => {
81-
return Err(ExecuteError::wrap(
82-
"invalid config data".to_string(),
83-
));
80+
return Err(ExecuteError::wrap("invalid config data"));
8481
}
8582
}
8683
}
8784
Err(error) => match error.kind() {
8885
IOErrorKind::NotFound => {
89-
return Err(ExecuteError::wrap(
90-
"database not found".to_string(),
91-
));
86+
return Err(ExecuteError::wrap("database not found"));
9287
}
9388
_ => {
9489
return Err(ExecuteError::wrap(format!("{:?}", error)));

0 commit comments

Comments
 (0)