- Restructure handlers into file_commands/file_queries/file_handlers - Add gRPC auth client, JWT middleware, rate limiting, request ID - Add common utilities: logger, sanitizer, s3_errors - Add unit tests for config, mediator, auth, request_id, sanitize - Add proto definitions and generated code - Remove old web UI pages - Add .dockerignore and .env.example
22 lines
485 B
Go
22 lines
485 B
Go
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"})
|
|
}
|
|
}
|