package endpoints import ( "rag/file-system/internal/common" "net/http" "github.com/gin-gonic/gin" ) func handleError(c *gin.Context, err error) { if be, ok := err.(*common.BusinessException); ok { c.JSON(be.Code, gin.H{"error": be.Message}) } else { common.Logger.Error("unhandled error", "error", err, "path", c.Request.URL.Path, "request_id", c.GetString("request_id"), ) c.JSON(http.StatusInternalServerError, gin.H{"error": "internal server error"}) } }