refactor: Use error!(e; xxx) pattern to log error (#195)

Use `error!(e; xxx)` pattern so we could get backtrace in error log.

Also use BoxedError as error source of ExecuteQuery instead of String,
so we could carry backtrace and other info in it.
This commit is contained in:
evenyag
2022-08-23 17:35:24 +08:00
committed by GitHub
parent ad14c83369
commit 8ea2aa73cf
6 changed files with 27 additions and 29 deletions
+5 -5
View File
@@ -257,7 +257,7 @@ impl LogFile {
batch.into_iter().for_each(AppendRequest::complete);
}
Err(e) => {
error!("Failed to flush log file: {}", e);
error!(e; "Failed to flush log file");
batch.into_iter().for_each(|r| r.fail());
state
.write_offset
@@ -265,7 +265,7 @@ impl LogFile {
}
},
Err(e) => {
error!("Failed to write append requests, error: {}", e);
error!(e; "Failed to write append requests");
batch.into_iter().for_each(|r| r.fail());
state
.write_offset
@@ -333,7 +333,7 @@ impl LogFile {
}
}
Err(e) => {
error!("Error while replay log {} {:?}", log_name, e);
error!(e; "Error while replay log {}", log_name);
break;
}
}
@@ -568,7 +568,7 @@ fn file_chunk_stream(
continue;
}
Err(e) => {
error!("Failed to read file chunk, error: {}", &e);
error!(e; "Failed to read file chunk");
// we're going to break any way so just forget the join result.
let _ = tx.blocking_send(Err(e));
break;
@@ -600,7 +600,7 @@ fn file_chunk_stream_sync(
continue;
}
Err(e) => {
error!("Failed to read file chunk, error: {}", &e);
error!(e; "Failed to read file chunk");
yield Err(e);
break;
}
+1 -1
View File
@@ -199,7 +199,7 @@ impl LogStore for LocalFileLogStore {
continue;
}
_ => {
error!("Failed to roll to next log file, error:{}", e);
error!(e; "Failed to roll to next log file");
return Err(e);
}
},