@@ -3,18 +3,15 @@ package api
3
3
import (
4
4
"delta/config"
5
5
"delta/core"
6
- "delta/utils "
6
+ _ "delta/docs/swagger "
7
7
"encoding/json"
8
8
"fmt"
9
9
"net/http"
10
10
"os"
11
11
"os/signal"
12
12
"strings"
13
13
"syscall"
14
- "time"
15
14
16
- _ "delta/docs/swagger"
17
- "github.com/application-research/delta-db/messaging"
18
15
logging "github.com/ipfs/go-log/v2"
19
16
"github.com/labstack/echo/v4"
20
17
"github.com/labstack/echo/v4/middleware"
@@ -268,46 +265,6 @@ func ValidateRequestBody() echo.MiddlewareFunc {
268
265
// ErrorHandler It's a function that is called when an error occurs.
269
266
func ErrorHandler (err error , c echo.Context ) {
270
267
271
- ip := DeltaNodeConfig .Node .AnnounceAddrIP
272
-
273
- // get the request body and log it
274
-
275
- s := struct {
276
- RemoteIP string `json:"remote_ip"`
277
- PublicIP string `json:"public_ip"`
278
- Host string `json:"host"`
279
- Referer string `json:"referer"`
280
- Request string `json:"request"`
281
- Path string `json:"path"`
282
- ErrorDetails string `json:"details"`
283
- }{
284
- RemoteIP : c .RealIP (),
285
- PublicIP : ip ,
286
- Host : c .Request ().Host ,
287
- Referer : c .Request ().Referer (),
288
- Request : c .Request ().RequestURI ,
289
- Path : c .Path (),
290
- ErrorDetails : err .Error (),
291
- }
292
-
293
- b , errM := json .Marshal (s )
294
- if errM != nil {
295
- log .Error (errM )
296
- }
297
-
298
- // It's sending the error to the log server.
299
- utils .GlobalDeltaDataReporter .TraceLog (
300
- messaging.LogEvent {
301
- LogEventType : "Error: " + core .GetHostname () + " " + c .Request ().Method + " " + c .Path (),
302
- SourceHost : core .GetHostname (),
303
- SourceIP : ip ,
304
- LogEventObject : b ,
305
- LogEvent : c .Path (),
306
- DeltaUuid : DeltaNodeConfig .Node .InstanceUuid ,
307
- CreatedAt : time .Now (),
308
- UpdatedAt : time .Now (),
309
- })
310
-
311
268
var httpRespErr * HttpError
312
269
if xerrors .As (err , & httpRespErr ) {
313
270
log .Errorf ("handler error: %s" , err )
0 commit comments