Skip to content

Latest commit

 

History

History
34 lines (25 loc) · 853 Bytes

File metadata and controls

34 lines (25 loc) · 853 Bytes

Response with Logger

This package enables response with event logging in go-restful apps. For the event logging please read logger/event package

Usage

Importing

import "github.com/AccelByte/go-restful-plugins/v4/pkg/response"

Write Response Success

Write(request, response, httpStatusCode, serviceType, eventID, message, entity)

Write Response Error

WriteError(request, response, httpStatusCode, serviceType, eventErr, errorResponse)

Error Response Example

&Error{
    ErrorCode:    unableToWriteResponse,
    ErrorMessage: "unable to write response",
    ErrorLogMsg:  fmt.Sprintf("unable to write response: %+v, body: %+v, error: %v", response, entity, err),
})

We recommend use "github.com/pkg/errors" to create error and wrap the errors with stack trace to help with debugging