MCPcopy Create free account
hub / github.com/daodst/chat / errorResponse

Function errorResponse

clientapi/routing/pushrules.go:16–31  ·  view source on GitHub ↗
(ctx context.Context, err error, msg string, args ...interface{})

Source from the content-addressed store, hash-verified

14)
15
16func errorResponse(ctx context.Context, err error, msg string, args ...interface{}) util.JSONResponse {
17 if eerr, ok := err.(*jsonerror.MatrixError); ok {
18 var status int
19 switch eerr.ErrCode {
20 case "M_INVALID_ARGUMENT_VALUE":
21 status = http.StatusBadRequest
22 case "M_NOT_FOUND":
23 status = http.StatusNotFound
24 default:
25 status = http.StatusInternalServerError
26 }
27 return util.MatrixErrorResponse(status, eerr.ErrCode, eerr.Err)
28 }
29 util.GetLogger(ctx).WithError(err).Errorf(msg, args...)
30 return jsonerror.InternalServerError()
31}
32
33func GetAllPushRules(ctx context.Context, device *userapi.Device, userAPI userapi.ClientUserAPI) util.JSONResponse {
34 ruleSets, err := queryPushRules(ctx, device.UserID, userAPI)

Callers 8

GetAllPushRulesFunction · 0.85
GetPushRulesByScopeFunction · 0.85
GetPushRulesByKindFunction · 0.85
GetPushRuleByRuleIDFunction · 0.85
PutPushRuleByRuleIDFunction · 0.85
DeletePushRuleByRuleIDFunction · 0.85
GetPushRuleAttrByRuleIDFunction · 0.85
PutPushRuleAttrByRuleIDFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected