1
0

feat: add internal error to log database

This commit is contained in:
2023-05-24 22:46:04 +00:00
parent 605871d17a
commit 7806a774e4
3 changed files with 55 additions and 9 deletions

17
pew.go
View File

@@ -377,7 +377,8 @@ type phasesResult struct {
Ok bool
}
InternalError error
InternalError error
InternalErrorString string
}
func copyFile(sourcePath, destinationPath string) (err error) {
@@ -401,12 +402,14 @@ func copyFile(sourcePath, destinationPath string) (err error) {
func dumpResult(q *qemu.System, ka config.Artifact, ki distro.KernelInfo,
res *phasesResult, dist, tag, binary string, db *sql.DB) {
// TODO refactor
if res.InternalError != nil {
q.Log.Error().Err(res.InternalError).
Str("panic", fmt.Sprintf("%v", q.KernelPanic)).
Str("timeout", fmt.Sprintf("%v", q.KilledByTimeout)).
Msg("internal")
return
res.InternalErrorString = res.InternalError.Error()
}
colored := ""
@@ -432,10 +435,12 @@ func dumpResult(q *qemu.System, ka config.Artifact, ki distro.KernelInfo,
additional = "(timeout)"
}
if additional != "" {
q.Log.Info().Msgf("%v %v", colored, additional)
} else {
q.Log.Info().Msgf("%v", colored)
if res.InternalError == nil {
if additional != "" {
q.Log.Info().Msgf("%v %v", colored, additional)
} else {
q.Log.Info().Msgf("%v", colored)
}
}
err := addToLog(db, q, ka, ki, res, tag)