Skip to content
This repository has been archived by the owner on Aug 31, 2022. It is now read-only.

Fix unhandled nil err check to prevent rpc causing a crash #78

Merged
merged 1 commit into from
Jul 28, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion transl_utils/transl_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ func __log_audit_msg(ctx context.Context, reqType string, uriPath string, err er
var err1 error
username := "invalid"
statusMsg := "failure"
errMsg := "None"
if (err == nil) {
statusMsg = "success"
} else {
errMsg = err.Error()
}

if Writer == nil {
Expand All @@ -38,7 +41,7 @@ func __log_audit_msg(ctx context.Context, reqType string, uriPath string, err er
common_utils.GetUsername(ctx, &username)

auditMsg := fmt.Sprintf("User \"%s\" request \"%s %s\" status - %s error - %s",
username, reqType, uriPath, statusMsg, err.Error())
username, reqType, uriPath, statusMsg, errMsg)
Writer.Info(auditMsg)
}

Expand Down