From d569063e29dec981b48adbb64efe8e68dbe37a87 Mon Sep 17 00:00:00 2001 From: Ulf Bjorkengren Date: Thu, 8 Feb 2024 14:43:50 +0100 Subject: [PATCH 1/2] Error code update. Signed-off-by: Ulf Bjorkengren --- server/vissv2server/serviceMgr/serviceMgr.go | 30 ++++++++++------ server/vissv2server/vissv2server.go | 29 ++++++++++------ utils/common.go | 36 +++++++++++++++++++- utils/managerdata.go | 16 +++++++++ 4 files changed, 90 insertions(+), 21 deletions(-) diff --git a/server/vissv2server/serviceMgr/serviceMgr.go b/server/vissv2server/serviceMgr/serviceMgr.go index c78feb05..b6b3b3a7 100644 --- a/server/vissv2server/serviceMgr/serviceMgr.go +++ b/server/vissv2server/serviceMgr/serviceMgr.go @@ -999,13 +999,15 @@ func ServiceMgrInit(mgrId int, serviceMgrChan chan string, stateStorageType stri switch requestMap["action"] { case "set": if strings.Contains(requestMap["path"].(string), "[") == true { - utils.SetErrorResponse(requestMap, errorResponseMap, "400", "Forbidden request", "Set request must only address a single end point.") +// utils.SetErrorResponse(requestMap, errorResponseMap, "400", "Forbidden request", "Set request must only address a single end point.") + utils.SetErrorResponse(requestMap, errorResponseMap, 1, "") //invalid_data dataChan <- utils.FinalizeMessage(errorResponseMap) break } ts := setVehicleData(requestMap["path"].(string), requestMap["value"].(string)) if len(ts) == 0 { - utils.SetErrorResponse(requestMap, errorResponseMap, "400", "Internal error", "Underlying system failed to update.") +// utils.SetErrorResponse(requestMap, errorResponseMap, "400", "Internal error", "Underlying system failed to update.") + utils.SetErrorResponse(requestMap, errorResponseMap, 7, "") //service_unavailable dataChan <- utils.FinalizeMessage(errorResponseMap) break } @@ -1015,7 +1017,8 @@ func ServiceMgrInit(mgrId int, serviceMgrChan chan string, stateStorageType stri pathArray := unpackPaths(requestMap["path"].(string)) if pathArray == nil { utils.Error.Printf("Unmarshal of path array failed.") - utils.SetErrorResponse(requestMap, errorResponseMap, "400", "Internal error.", "Unmarshal failed on array of paths.") +// utils.SetErrorResponse(requestMap, errorResponseMap, "400", "Internal error.", "Unmarshal failed on array of paths.") + utils.SetErrorResponse(requestMap, errorResponseMap, 1, "") //invalid_data dataChan <- utils.FinalizeMessage(errorResponseMap) break } @@ -1024,7 +1027,8 @@ func ServiceMgrInit(mgrId int, serviceMgrChan chan string, stateStorageType stri utils.UnpackFilter(requestMap["filter"], &filterList) if len(filterList) == 0 { utils.Error.Printf("Request filter malformed.") - utils.SetErrorResponse(requestMap, errorResponseMap, "400", "Bad request", "Request filter malformed.") +// utils.SetErrorResponse(requestMap, errorResponseMap, "400", "Bad request", "Request filter malformed.") + utils.SetErrorResponse(requestMap, errorResponseMap, 0, "") //bad_request dataChan <- utils.FinalizeMessage(errorResponseMap) break } @@ -1037,7 +1041,8 @@ func ServiceMgrInit(mgrId int, serviceMgrChan chan string, stateStorageType stri dataPack := getDataPack(pathArray, filterList) if len(dataPack) == 0 { utils.Info.Printf("No historic data available") - utils.SetErrorResponse(requestMap, errorResponseMap, "404", "Not found", "Historic data not available.") +// utils.SetErrorResponse(requestMap, errorResponseMap, "404", "Not found", "Historic data not available.") + utils.SetErrorResponse(requestMap, errorResponseMap, 6, "") //unavailable_data dataChan <- utils.FinalizeMessage(errorResponseMap) break } @@ -1048,13 +1053,15 @@ func ServiceMgrInit(mgrId int, serviceMgrChan chan string, stateStorageType stri subscriptionState.RouterId = requestMap["RouterId"].(string) subscriptionState.Path = unpackPaths(requestMap["path"].(string)) if requestMap["filter"] == nil || requestMap["filter"] == "" { - utils.SetErrorResponse(requestMap, errorResponseMap, "400", "Filter missing.", "") +// utils.SetErrorResponse(requestMap, errorResponseMap, "400", "Filter missing.", "") + utils.SetErrorResponse(requestMap, errorResponseMap, 0, "") //bad_request dataChan <- utils.FinalizeMessage(errorResponseMap) break } utils.UnpackFilter(requestMap["filter"], &(subscriptionState.FilterList)) if len(subscriptionState.FilterList) == 0 { - utils.SetErrorResponse(requestMap, errorResponseMap, "400", "Invalid filter.", "See VISSv2 specification.") +// utils.SetErrorResponse(requestMap, errorResponseMap, "400", "Invalid filter.", "See VISSv2 specification.") + utils.SetErrorResponse(requestMap, errorResponseMap, 1, "") //invalid_data dataChan <- utils.FinalizeMessage(errorResponseMap) } if requestMap["gatingId"] != nil { @@ -1080,7 +1087,8 @@ func ServiceMgrInit(mgrId int, serviceMgrChan chan string, stateStorageType stri requestMap["subscriptionId"] = subscriptId } } - utils.SetErrorResponse(requestMap, errorResponseMap, "400", "Unsubscribe failed.", "Incorrect or missing subscription id.") +// utils.SetErrorResponse(requestMap, errorResponseMap, "400", "Unsubscribe failed.", "Incorrect or missing subscription id.") + utils.SetErrorResponse(requestMap, errorResponseMap, 1, "") //invalid_data dataChan <- utils.FinalizeMessage(errorResponseMap) case "internal-killsubscriptions": isRemoved := true @@ -1094,12 +1102,14 @@ func ServiceMgrInit(mgrId int, serviceMgrChan chan string, stateStorageType stri requestMap["action"] = "subscription" requestMap["requestId"] = nil requestMap["subscriptionId"] = subscriptionId - utils.SetErrorResponse(requestMap, errorResponseMap, "401", "Token expired or consent cancelled.", "") +// utils.SetErrorResponse(requestMap, errorResponseMap, "401", "Token expired or consent cancelled.", "") + utils.SetErrorResponse(requestMap, errorResponseMap, 2, "") //expired_token dataChan <- utils.FinalizeMessage(errorResponseMap) _, subscriptionList = scanAndRemoveListItem(subscriptionList, routerId) } default: - utils.SetErrorResponse(requestMap, errorResponseMap, "400", "Unknown action.", "") +// utils.SetErrorResponse(requestMap, errorResponseMap, "400", "Unknown action.", "") + utils.SetErrorResponse(requestMap, errorResponseMap, 1, "") //invalid_data dataChan <- utils.FinalizeMessage(errorResponseMap) } // switch case <-dummyTicker.C: diff --git a/server/vissv2server/vissv2server.go b/server/vissv2server/vissv2server.go index 188e8a5b..66475271 100644 --- a/server/vissv2server/vissv2server.go +++ b/server/vissv2server/vissv2server.go @@ -225,7 +225,7 @@ func getTokenErrorMessage(index int) string { } func setTokenErrorResponse(reqMap map[string]interface{}, errorCode int) { - utils.SetErrorResponse(reqMap, errorResponseMap, "400", "Bad Request", getTokenErrorMessage(errorCode)) + utils.SetErrorResponse(reqMap, errorResponseMap, 3, getTokenErrorMessage(errorCode)) } // Sends a message to the Access Token Server to validate the Access Token paths and permissions @@ -572,19 +572,22 @@ func serveRequest(request string, tDChanIndex int, sDChanIndex int) { var requestMap = make(map[string]interface{}) if utils.MapRequest(request, &requestMap) != 0 { utils.Error.Printf("serveRequest():invalid JSON format=%s", request) - utils.SetErrorResponse(requestMap, errorResponseMap, "400", "invalid request syntax", "See VISSv2 spec and JSON RFC for valid request syntax.") +// utils.SetErrorResponse(requestMap, errorResponseMap, "400", "invalid request syntax", "See VISSv2 spec and JSON RFC for valid request syntax.") + utils.SetErrorResponse(requestMap, errorResponseMap, 0, "") //bad_request backendChan[tDChanIndex] <- utils.FinalizeMessage(errorResponseMap) return } if requestMap["action"] == nil || validRequest(request, requestMap["action"].(string)) == false { utils.Error.Printf("serveRequest():invalid action params=%s", requestMap["action"]) - utils.SetErrorResponse(requestMap, errorResponseMap, "400", "invalid request syntax", "Request parameter invalid.") +// utils.SetErrorResponse(requestMap, errorResponseMap, "400", "invalid request syntax", "Request parameter invalid.") + utils.SetErrorResponse(requestMap, errorResponseMap, 1, "") //invalid_data backendChan[tDChanIndex] <- utils.FinalizeMessage(errorResponseMap) return } if requestMap["path"] != nil && strings.Contains(requestMap["path"].(string), "*") == true { utils.Error.Printf("serveRequest():path contained wildcard=%s", requestMap["path"]) - utils.SetErrorResponse(requestMap, errorResponseMap, "400", "invalid request syntax", "Wildcard must be in filter expression.") +// utils.SetErrorResponse(requestMap, errorResponseMap, "400", "invalid request syntax", "Wildcard must be in filter expression.") + utils.SetErrorResponse(requestMap, errorResponseMap, 1, "") //invalid_data backendChan[tDChanIndex] <- utils.FinalizeMessage(errorResponseMap) return } @@ -593,7 +596,8 @@ func serveRequest(request string, tDChanIndex int, sDChanIndex int) { } if requestMap["action"] == "set" && requestMap["filter"] != nil { utils.Error.Printf("serveRequest():Set request combined with filtering.") - utils.SetErrorResponse(requestMap, errorResponseMap, "400", "invalid request", "Set request must not contain filtering.") +// utils.SetErrorResponse(requestMap, errorResponseMap, "400", "invalid request", "Set request must not contain filtering.") + utils.SetErrorResponse(requestMap, errorResponseMap, 0, "") //bad_request backendChan[tDChanIndex] <- utils.FinalizeMessage(errorResponseMap) return } @@ -625,7 +629,8 @@ func issueServiceRequest(requestMap map[string]interface{}, tDChanIndex int, sDC err := json.Unmarshal([]byte(filterList[i].Parameter), &searchPath) // Writes in search path all values in filter if err != nil { utils.Error.Printf("Unmarshal filter path array failed.") - utils.SetErrorResponse(requestMap, errorResponseMap, "400", "Internal error.", "Unmarshall failed on array of paths.") +// utils.SetErrorResponse(requestMap, errorResponseMap, "400", "Internal error.", "Unmarshall failed on array of paths.") + utils.SetErrorResponse(requestMap, errorResponseMap, 0, "") //bad_request backendChan[tDChanIndex] <- utils.FinalizeMessage(errorResponseMap) return } @@ -655,7 +660,8 @@ func issueServiceRequest(requestMap map[string]interface{}, tDChanIndex int, sDC return } utils.Error.Printf("Metadata not available.") - utils.SetErrorResponse(requestMap, errorResponseMap, "400", "Bad request", "Metadata not available.") +// utils.SetErrorResponse(requestMap, errorResponseMap, "400", "Bad request", "Metadata not available.") + utils.SetErrorResponse(requestMap, errorResponseMap, 0, "") //bad_request backendChan[tDChanIndex] <- utils.FinalizeMessage(errorResponseMap) return } @@ -689,12 +695,14 @@ func issueServiceRequest(requestMap map[string]interface{}, tDChanIndex int, sDC maxValidation = utils.GetMaxValidation(int(validation), maxValidation) } if totalMatches == 0 { - utils.SetErrorResponse(requestMap, errorResponseMap, "400", "No signals matching path.", "") +// utils.SetErrorResponse(requestMap, errorResponseMap, "400", "No signals matching path.", "") + utils.SetErrorResponse(requestMap, errorResponseMap, 6, "") //unavailable_data backendChan[tDChanIndex] <- utils.FinalizeMessage(errorResponseMap) return } if requestMap["action"] == "set" && golib.VSSgetType(searchData[0].NodeHandle) != gomodel.ACTUATOR { - utils.SetErrorResponse(requestMap, errorResponseMap, "400", "Illegal command", "Only the actuator node type can be set.") +// utils.SetErrorResponse(requestMap, errorResponseMap, "400", "Illegal command", "Only the actuator node type can be set.") + utils.SetErrorResponse(requestMap, errorResponseMap, 1, "") //invalid_data backendChan[tDChanIndex] <- utils.FinalizeMessage(errorResponseMap) return } @@ -735,7 +743,8 @@ func issueServiceRequest(requestMap map[string]interface{}, tDChanIndex int, sDC return } default: // should not be possible... - utils.SetErrorResponse(requestMap, errorResponseMap, "400", "Access control tag invalid.", "See VISSv2 spec for access control tagging") +// utils.SetErrorResponse(requestMap, errorResponseMap, "400", "Access control tag invalid.", "See VISSv2 spec for access control tagging") + utils.SetErrorResponse(requestMap, errorResponseMap, 7, "") //service_unavailable backendChan[tDChanIndex] <- utils.FinalizeMessage(errorResponseMap) return } diff --git a/utils/common.go b/utils/common.go index 25700271..3918149e 100644 --- a/utils/common.go +++ b/utils/common.go @@ -154,7 +154,7 @@ func ExtractFromToken(token string, claim string) string { // TODO remove white return "" } -func SetErrorResponse(reqMap map[string]interface{}, errRespMap map[string]interface{}, number string, reason string, message string) { +/*func SetErrorResponse(reqMap map[string]interface{}, errRespMap map[string]interface{}, number string, reason string, message string) { if reqMap["RouterId"] != nil { errRespMap["RouterId"] = reqMap["RouterId"] } @@ -176,6 +176,40 @@ func SetErrorResponse(reqMap map[string]interface{}, errRespMap map[string]inter } errRespMap["error"] = errMap errRespMap["ts"] = GetRfcTime() +}*/ + +//func SetErrorResponse(reqMap map[string]interface{}, errRespMap map[string]interface{}, number string, reason string, message string) { +func SetErrorResponse(reqMap map[string]interface{}, errRespMap map[string]interface{}, errorListIndex int, altErrorMessage string) { + if reqMap["RouterId"] != nil { + errRespMap["RouterId"] = reqMap["RouterId"] + } + if reqMap["action"] != nil { + errRespMap["action"] = reqMap["action"] + } + if reqMap["requestId"] != nil { + errRespMap["requestId"] = reqMap["requestId"] + } else { + delete(errRespMap, "requestId") + } + if reqMap["subscriptionId"] != nil { + errRespMap["subscriptionId"] = reqMap["subscriptionId"] + } + errorMessage := ErrorInfoList[errorListIndex].Message + if len(altErrorMessage) > 0 { + errorMessage = altErrorMessage + } + errMap := map[string]interface{}{ + "number": ErrorInfoList[errorListIndex].Number, + "reason": ErrorInfoList[errorListIndex].Reason, + "message": errorMessage, + } +/* errMap := map[string]interface{}{ + "number": number, + "reason": reason, + "message": message, + }*/ + errRespMap["error"] = errMap + errRespMap["ts"] = GetRfcTime() } func FinalizeMessage(responseMap map[string]interface{}) string { diff --git a/utils/managerdata.go b/utils/managerdata.go index 46105c89..95a4b769 100644 --- a/utils/managerdata.go +++ b/utils/managerdata.go @@ -43,6 +43,22 @@ const ( PB_LEVEL2 = 3 // path is represented by integer index, retrieved from vsspathlist.json ) +type ErrorInformation struct { + Number string + Reason string + Message string +} + +var ErrorInfoList [8]ErrorInformation = [8]ErrorInformation{ + {"400","bad_request","The request is malformed."}, + {"400","invalid_data","Data present in the request is invalid."}, + {"401","expired_token","Access token has expired."}, + {"401","invalid_token","Access token is invalid."}, + {"401","missing_token","Access token is missing."}, + {"403","forbidden_request","The server refuses to carry out the request."}, + {"404","unavailable_data","The requested data was not found."}, + {"503","service_unavailable","The server is temporarily unable to handle the request."}} + var MuxServer = []*http.ServeMux{ http.NewServeMux(), // for app client HTTP sessions http.NewServeMux(), // for app client WS sessions From f8c86b4b325f32aecca923029c6681453be79454 Mon Sep 17 00:00:00 2001 From: Ulf Bjorkengren Date: Fri, 9 Feb 2024 11:25:21 +0100 Subject: [PATCH 2/2] Error code cleanup Signed-off-by: Ulf Bjorkengren --- server/vissv2server/serviceMgr/serviceMgr.go | 12 +----------- server/vissv2server/vissv2server.go | 9 --------- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/server/vissv2server/serviceMgr/serviceMgr.go b/server/vissv2server/serviceMgr/serviceMgr.go index b6b3b3a7..f1638477 100644 --- a/server/vissv2server/serviceMgr/serviceMgr.go +++ b/server/vissv2server/serviceMgr/serviceMgr.go @@ -999,14 +999,12 @@ func ServiceMgrInit(mgrId int, serviceMgrChan chan string, stateStorageType stri switch requestMap["action"] { case "set": if strings.Contains(requestMap["path"].(string), "[") == true { -// utils.SetErrorResponse(requestMap, errorResponseMap, "400", "Forbidden request", "Set request must only address a single end point.") utils.SetErrorResponse(requestMap, errorResponseMap, 1, "") //invalid_data dataChan <- utils.FinalizeMessage(errorResponseMap) break } ts := setVehicleData(requestMap["path"].(string), requestMap["value"].(string)) if len(ts) == 0 { -// utils.SetErrorResponse(requestMap, errorResponseMap, "400", "Internal error", "Underlying system failed to update.") utils.SetErrorResponse(requestMap, errorResponseMap, 7, "") //service_unavailable dataChan <- utils.FinalizeMessage(errorResponseMap) break @@ -1017,7 +1015,6 @@ func ServiceMgrInit(mgrId int, serviceMgrChan chan string, stateStorageType stri pathArray := unpackPaths(requestMap["path"].(string)) if pathArray == nil { utils.Error.Printf("Unmarshal of path array failed.") -// utils.SetErrorResponse(requestMap, errorResponseMap, "400", "Internal error.", "Unmarshal failed on array of paths.") utils.SetErrorResponse(requestMap, errorResponseMap, 1, "") //invalid_data dataChan <- utils.FinalizeMessage(errorResponseMap) break @@ -1027,7 +1024,6 @@ func ServiceMgrInit(mgrId int, serviceMgrChan chan string, stateStorageType stri utils.UnpackFilter(requestMap["filter"], &filterList) if len(filterList) == 0 { utils.Error.Printf("Request filter malformed.") -// utils.SetErrorResponse(requestMap, errorResponseMap, "400", "Bad request", "Request filter malformed.") utils.SetErrorResponse(requestMap, errorResponseMap, 0, "") //bad_request dataChan <- utils.FinalizeMessage(errorResponseMap) break @@ -1041,7 +1037,6 @@ func ServiceMgrInit(mgrId int, serviceMgrChan chan string, stateStorageType stri dataPack := getDataPack(pathArray, filterList) if len(dataPack) == 0 { utils.Info.Printf("No historic data available") -// utils.SetErrorResponse(requestMap, errorResponseMap, "404", "Not found", "Historic data not available.") utils.SetErrorResponse(requestMap, errorResponseMap, 6, "") //unavailable_data dataChan <- utils.FinalizeMessage(errorResponseMap) break @@ -1053,14 +1048,12 @@ func ServiceMgrInit(mgrId int, serviceMgrChan chan string, stateStorageType stri subscriptionState.RouterId = requestMap["RouterId"].(string) subscriptionState.Path = unpackPaths(requestMap["path"].(string)) if requestMap["filter"] == nil || requestMap["filter"] == "" { -// utils.SetErrorResponse(requestMap, errorResponseMap, "400", "Filter missing.", "") utils.SetErrorResponse(requestMap, errorResponseMap, 0, "") //bad_request dataChan <- utils.FinalizeMessage(errorResponseMap) break } utils.UnpackFilter(requestMap["filter"], &(subscriptionState.FilterList)) if len(subscriptionState.FilterList) == 0 { -// utils.SetErrorResponse(requestMap, errorResponseMap, "400", "Invalid filter.", "See VISSv2 specification.") utils.SetErrorResponse(requestMap, errorResponseMap, 1, "") //invalid_data dataChan <- utils.FinalizeMessage(errorResponseMap) } @@ -1087,7 +1080,6 @@ func ServiceMgrInit(mgrId int, serviceMgrChan chan string, stateStorageType stri requestMap["subscriptionId"] = subscriptId } } -// utils.SetErrorResponse(requestMap, errorResponseMap, "400", "Unsubscribe failed.", "Incorrect or missing subscription id.") utils.SetErrorResponse(requestMap, errorResponseMap, 1, "") //invalid_data dataChan <- utils.FinalizeMessage(errorResponseMap) case "internal-killsubscriptions": @@ -1102,13 +1094,11 @@ func ServiceMgrInit(mgrId int, serviceMgrChan chan string, stateStorageType stri requestMap["action"] = "subscription" requestMap["requestId"] = nil requestMap["subscriptionId"] = subscriptionId -// utils.SetErrorResponse(requestMap, errorResponseMap, "401", "Token expired or consent cancelled.", "") - utils.SetErrorResponse(requestMap, errorResponseMap, 2, "") //expired_token + utils.SetErrorResponse(requestMap, errorResponseMap, 2, "Token expired or consent cancelled.") dataChan <- utils.FinalizeMessage(errorResponseMap) _, subscriptionList = scanAndRemoveListItem(subscriptionList, routerId) } default: -// utils.SetErrorResponse(requestMap, errorResponseMap, "400", "Unknown action.", "") utils.SetErrorResponse(requestMap, errorResponseMap, 1, "") //invalid_data dataChan <- utils.FinalizeMessage(errorResponseMap) } // switch diff --git a/server/vissv2server/vissv2server.go b/server/vissv2server/vissv2server.go index 66475271..aa58b89a 100644 --- a/server/vissv2server/vissv2server.go +++ b/server/vissv2server/vissv2server.go @@ -572,21 +572,18 @@ func serveRequest(request string, tDChanIndex int, sDChanIndex int) { var requestMap = make(map[string]interface{}) if utils.MapRequest(request, &requestMap) != 0 { utils.Error.Printf("serveRequest():invalid JSON format=%s", request) -// utils.SetErrorResponse(requestMap, errorResponseMap, "400", "invalid request syntax", "See VISSv2 spec and JSON RFC for valid request syntax.") utils.SetErrorResponse(requestMap, errorResponseMap, 0, "") //bad_request backendChan[tDChanIndex] <- utils.FinalizeMessage(errorResponseMap) return } if requestMap["action"] == nil || validRequest(request, requestMap["action"].(string)) == false { utils.Error.Printf("serveRequest():invalid action params=%s", requestMap["action"]) -// utils.SetErrorResponse(requestMap, errorResponseMap, "400", "invalid request syntax", "Request parameter invalid.") utils.SetErrorResponse(requestMap, errorResponseMap, 1, "") //invalid_data backendChan[tDChanIndex] <- utils.FinalizeMessage(errorResponseMap) return } if requestMap["path"] != nil && strings.Contains(requestMap["path"].(string), "*") == true { utils.Error.Printf("serveRequest():path contained wildcard=%s", requestMap["path"]) -// utils.SetErrorResponse(requestMap, errorResponseMap, "400", "invalid request syntax", "Wildcard must be in filter expression.") utils.SetErrorResponse(requestMap, errorResponseMap, 1, "") //invalid_data backendChan[tDChanIndex] <- utils.FinalizeMessage(errorResponseMap) return @@ -596,7 +593,6 @@ func serveRequest(request string, tDChanIndex int, sDChanIndex int) { } if requestMap["action"] == "set" && requestMap["filter"] != nil { utils.Error.Printf("serveRequest():Set request combined with filtering.") -// utils.SetErrorResponse(requestMap, errorResponseMap, "400", "invalid request", "Set request must not contain filtering.") utils.SetErrorResponse(requestMap, errorResponseMap, 0, "") //bad_request backendChan[tDChanIndex] <- utils.FinalizeMessage(errorResponseMap) return @@ -629,7 +625,6 @@ func issueServiceRequest(requestMap map[string]interface{}, tDChanIndex int, sDC err := json.Unmarshal([]byte(filterList[i].Parameter), &searchPath) // Writes in search path all values in filter if err != nil { utils.Error.Printf("Unmarshal filter path array failed.") -// utils.SetErrorResponse(requestMap, errorResponseMap, "400", "Internal error.", "Unmarshall failed on array of paths.") utils.SetErrorResponse(requestMap, errorResponseMap, 0, "") //bad_request backendChan[tDChanIndex] <- utils.FinalizeMessage(errorResponseMap) return @@ -660,7 +655,6 @@ func issueServiceRequest(requestMap map[string]interface{}, tDChanIndex int, sDC return } utils.Error.Printf("Metadata not available.") -// utils.SetErrorResponse(requestMap, errorResponseMap, "400", "Bad request", "Metadata not available.") utils.SetErrorResponse(requestMap, errorResponseMap, 0, "") //bad_request backendChan[tDChanIndex] <- utils.FinalizeMessage(errorResponseMap) return @@ -695,13 +689,11 @@ func issueServiceRequest(requestMap map[string]interface{}, tDChanIndex int, sDC maxValidation = utils.GetMaxValidation(int(validation), maxValidation) } if totalMatches == 0 { -// utils.SetErrorResponse(requestMap, errorResponseMap, "400", "No signals matching path.", "") utils.SetErrorResponse(requestMap, errorResponseMap, 6, "") //unavailable_data backendChan[tDChanIndex] <- utils.FinalizeMessage(errorResponseMap) return } if requestMap["action"] == "set" && golib.VSSgetType(searchData[0].NodeHandle) != gomodel.ACTUATOR { -// utils.SetErrorResponse(requestMap, errorResponseMap, "400", "Illegal command", "Only the actuator node type can be set.") utils.SetErrorResponse(requestMap, errorResponseMap, 1, "") //invalid_data backendChan[tDChanIndex] <- utils.FinalizeMessage(errorResponseMap) return @@ -743,7 +735,6 @@ func issueServiceRequest(requestMap map[string]interface{}, tDChanIndex int, sDC return } default: // should not be possible... -// utils.SetErrorResponse(requestMap, errorResponseMap, "400", "Access control tag invalid.", "See VISSv2 spec for access control tagging") utils.SetErrorResponse(requestMap, errorResponseMap, 7, "") //service_unavailable backendChan[tDChanIndex] <- utils.FinalizeMessage(errorResponseMap) return