Skip to content

Commit

Permalink
fix: hide err details
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgao001 committed Jul 24, 2024
1 parent b77228d commit 6566e82
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions restapi/handlers/blob.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func HandleGetBlobSidecars() func(params blob.GetBlobSidecarsByBlockNumParams) m
}
sidecars, err = service.BlobSvc.GetBlobSidecarsByRoot(hex.EncodeToString(root), indicesInx)
if err != nil {
return blob.NewGetBlobSidecarsByBlockNumInternalServerError().WithPayload(service.InternalErrorWithError(err))
return blob.NewGetBlobSidecarsByBlockNumInternalServerError().WithPayload(service.InternalError())
}
} else {
slot, err := util.StringToUint64(blockID)
Expand All @@ -54,7 +54,7 @@ func HandleGetBlobSidecars() func(params blob.GetBlobSidecarsByBlockNumParams) m
}
sidecars, err = service.BlobSvc.GetBlobSidecarsByBlockNumOrSlot(slot, indicesInx)
if err != nil {
return blob.NewGetBlobSidecarsByBlockNumInternalServerError().WithPayload(service.InternalErrorWithError(err))
return blob.NewGetBlobSidecarsByBlockNumInternalServerError().WithPayload(service.InternalError())
}
}
payload := models.GetBlobSideCarsResponse{
Expand Down Expand Up @@ -99,7 +99,7 @@ func HandleGetBSCBlobSidecars() func(params blob.GetBSCBlobSidecarsByBlockNumPar
}
sidecars, err := service.BlobSvc.GetBlobSidecarsByBlockNumOrSlot(blockNum, nil)
if err != nil {
return blob.NewGetBlobSidecarsByBlockNumInternalServerError().WithPayload(service.InternalErrorWithError(err))
return blob.NewGetBlobSidecarsByBlockNumInternalServerError().WithPayload(service.InternalError())
}
// group sidecars by tx hash
bscTxSidecars := make(map[string]*models.BSCBlobTxSidecar)
Expand Down
4 changes: 2 additions & 2 deletions service/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ func (e Err) Error() string {
return fmt.Sprintf("%d: %s", e.Code, e.Message)
}

func InternalErrorWithError(err error) *models.Error {
func InternalError() *models.Error {
return &models.Error{
Code: 500,
Message: err.Error(),
Message: "internal error",
}
}

Expand Down

0 comments on commit 6566e82

Please sign in to comment.