refact: add log for export
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"gitea.com/texpixel/document_ai/internal/model/task"
|
"gitea.com/texpixel/document_ai/internal/model/task"
|
||||||
"gitea.com/texpixel/document_ai/internal/storage/dao"
|
"gitea.com/texpixel/document_ai/internal/storage/dao"
|
||||||
@@ -187,8 +188,13 @@ func (svc *TaskService) ExportTask(ctx context.Context, req *task.ExportTaskRequ
|
|||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
if resp.StatusCode != http.StatusOK {
|
if resp.StatusCode != http.StatusOK {
|
||||||
body, _ := io.ReadAll(resp.Body)
|
respBody, _ := io.ReadAll(resp.Body)
|
||||||
log.Error(ctx, "func", "ExportTask", "msg", "http request failed", "status", resp.StatusCode, "body", string(body))
|
log.Error(ctx, "func", "ExportTask", "msg", "export service returned non-200",
|
||||||
|
"status", resp.StatusCode,
|
||||||
|
"body", string(respBody),
|
||||||
|
"markdown_len", len(markdown),
|
||||||
|
"filename", filename,
|
||||||
|
)
|
||||||
return nil, "", fmt.Errorf("export service returned status: %d", resp.StatusCode)
|
return nil, "", fmt.Errorf("export service returned status: %d", resp.StatusCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user