chore(executor/sandbox): clearer error log
This commit is contained in:
parent
dec9cf2cd1
commit
2ddeb473af
|
@ -112,14 +112,16 @@ func convertPBFile(i stage.CmdFile) *pb.Request_File {
|
||||||
case i.Src != nil:
|
case i.Src != nil:
|
||||||
if !filepath.IsAbs(*i.Src) {
|
if !filepath.IsAbs(*i.Src) {
|
||||||
absPath, err := filepath.Abs(*i.Src)
|
absPath, err := filepath.Abs(*i.Src)
|
||||||
if err == nil {
|
if err != nil {
|
||||||
i.Src = &absPath
|
slog.Error("convert pb file get abs path", "path", *i.Src, "error", err)
|
||||||
|
absPath = "/"
|
||||||
}
|
}
|
||||||
|
i.Src = &absPath
|
||||||
}
|
}
|
||||||
s, err := os.ReadFile(*i.Src)
|
s, err := os.ReadFile(*i.Src)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s = []byte{}
|
s = []byte{}
|
||||||
slog.Error("read file error", "path", *i.Src, "error", err)
|
slog.Error("convert pb file read file", "path", *i.Src, "error", err)
|
||||||
}
|
}
|
||||||
return &pb.Request_File{File: &pb.Request_File_Memory{Memory: &pb.Request_MemoryFile{Content: s}}}
|
return &pb.Request_File{File: &pb.Request_File_Memory{Memory: &pb.Request_MemoryFile{Content: s}}}
|
||||||
case i.Content != nil:
|
case i.Content != nil:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user