-
Notifications
You must be signed in to change notification settings - Fork 831
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docs: Update Gharial error codes (DocuBlocks) #10760
Conversation
Could not reproduce Some of the error messages are not very helpful or even incorrect nonetheless, needs further investigation. |
Related: #11730 WIP script for testing the return codes: #!/bin/bash
# Config
server="http://0.0.0.0:8520"
cred="root:"
# Internal
prevDescription=""
echo
test_route() {
local description="$1"
local method="$2"
local path="$3"
local body="$4"
local comment="$5"
if [ "$description" != "$prevDescription" ]; then
echo "$description"
fi
echo -e " \e[36m$method $path \e[35m$body\e[0m"
# jq 'with_entries(select([.key] | inside(["code","errorMessage"])))'
res=$(curl -s -u "$cred" --data-binary "$body" -X "$method" "$server$path" | jq --raw-output '(.code | tostring) + ": " + .errorMessage' 2>&1)
echo -e " \e[31m$res\e[0m $comment\n"
prevDescription="$description"
}
# Tests
test_route "Graph Create" "POST" "/_api/gharial" '{"name": "g"}' "ok"
test_route "Graph Create Sync" "POST" "/_api/gharial?waitForSync=true" '{"name": "gs"}' "ok"
test_route "Edge Definition Add" "POST" "/_api/gharial/g/edge" '{"collection": "ecoll", "from": ["vcoll"], "to": ["vcoll"]}' "ok"
test_route "Edge Definition Add" "POST" "/_api/gharial/g/edge" '{"collection": "ecoll", "from": 1, "to": 2}' "500 expected array for from / to"
test_route "Edge Definition Add" "POST" "/_api/gharial/g/edge" '{"collection": "ecoll", "from": [""], "to": [""]}' "500 multi-use of edge coll"
test_route "Edge Definition Add" "POST" "/_api/gharial/g/edge" '{"collection": "ecoll2", "from": [""], "to": [""]}' "400 illegal vertex collection name"
test_route "Edge Definition Replace" "PUT" "/_api/gharial/g/edge/ecoll" '{"collection": "ecoll", "from": ["vcoll"], "to": ["vcoll"]}' "ok"
test_route "Edge Definition Replace" "PUT" "/_api/gharial/g/edge/missing-ecoll" '{"collection": "ecoll", "from": ["vcoll"], "to": ["vcoll"]}' "ok"
test_route "Edge Definition Remove" "DELETE" "/_api/gharial/g/edge/missing-ecoll" '' "seems ok"
test_route "Edge Definition Remove" "DELETE" "/_api/gharial/missing/edge/ecoll" '' "ok, 404 graph not found"
# Edge Definition Remove???
#test_route "Vertex Collection Add" "POST" "/_api/gharial/g/vertex" '{}' "500 VPack error with {} body (probably other routes as well), 400 if already in use by graph (but with error collection used in orphans)"
#test_route "Vertex Collections List" "GET" "/_api/gharial/g/vertex" '{}' "404 if graph not found"
#test_route "Vertex Collection Remove" "DELETE" "/_api/gharial/g/vertex/vcoll" '{}' "400 if coll is not part of graph (with error not in list of orphan collections),"
test_route "Vertex Create" "POST" "/_api/gharial/g/vertex/vcoll" '{"_key": "v1"}' "ok"
#test_route "Vertex Create" "POST" "/_api/gharial/g/vertex/vcoll" '{}' "404 collection or view not found"
#test_route "Vertex Get" "GET" "/_api/gharial/g/vertex/vcoll/v1" '{}' "404 collection or view not found if vertex collection is missing, 404 document not found if vertex is missing"
#test_route "Vertex Update" "PATCH" "/_api/gharial/g/vertex/vcoll/v1" '{}' "404 collection or view not found if vertex collection is missing, 404 document not found if vertex is missing"
#test_route "Vertex Replace" "PUT" "/_api/gharial/g/vertex/vcoll/v1" '{}' "404 collection or view not found if vertex collection is missing, 404 document not found if vertex is missing"
#test_route "Vertex Remove" "DELETE" "/_api/gharial/g/vertex/vcoll/v1" '{}' "404 collection or view not found if vertex collection is missing, 404 document not found if vertex is missing"
test_route "Edge Create" "POST" "/_api/gharial/g/edge/ecoll" '{"_key": "e1"}' "ok, missing _from / _to"
test_route "Edge Create" "POST" "/_api/gharial/g/edge/ecoll" '{"_key": "e1", "_from": "invalid", "_to": "vcoll/v1"}' "ok, malformed _from / _to"
test_route "Edge Create" "POST" "/_api/gharial/g/edge/ecoll" '{"_key": "e1", "_from": "vcoll/missing", "_to": "vcoll/v1"}' "ok, missing vertex"
test_route "Edge Create" "POST" "/_api/gharial/g/edge/ecoll" '{"_key": "e1", "_from": "missing/v1", "_to": "vcoll/v1"}' "vertex coll missing, but error reports missing edge collection?!"
test_route "Edge Create" "POST" "/_api/gharial/g/edge/ecoll" '{"_key": "e1", "_from": "vcoll/v1", "_to": "vcoll/v1"}' "ok"
#test_route "Edge Get" "GET" "/_api/gharial/g/edge/ecoll/e1" '{}' "404 if edge not found"
#test_route "Edge Update" "PATCH" "/_api/gharial/g/edge/ecoll/e1" '{}' "changes _from/_to without checking if the vertex collection or vertex exists!!!"
#test_route "Edge Replace" "PUT" "/_api/gharial/g/edge/ecoll/e1" '{}' "404 if vertex not found, but 400 no collection name specified (?!) if vertex collection is missing"
#test_route "Edge Remove" "DELETE" "/_api/gharial/g/edge/ecoll/e1" '{}' "404 if edge not found (with error edge collection not used in graph?!), same erorr if edge coll is not found"
test_route "Graph Remove" "DELETE" "/_api/gharial/g?dropCollections=true" '' "ok"
test_route "Graph Remove Sync" "DELETE" "/_api/gharial/gs?dropCollections=true" '{"waitForSync": true}' "not as documented?!"
|
The request succeeds if I use a valid vertex collection, which proves that the edge collection is fine. If an edge definition is not found (path parameter), then Only half of the PR changes are true right now, waiting for bug fix / confirmation on missing vertex collection issue. |
…f vertex not found.
There are still some include DocuBlocks with old links, but they appear to be unused.
https://arangodb.atlassian.net/browse/BTS-309 introduced a new error to clearly state when a referenced vertex collection does not exist and it's now a 400 error as was stated in the 3.6 release notes (but apparently never implemented?) |
With BTS-309 fixed it's 400 if vertex coll not found, but still 400 if vertex not found. Remove legacy links from Rest DocuBlocks. There are still some include DocuBlocks with old links, but they appear to be unused.
With BTS-309 fixed it's 400 if vertex coll not found, but still 400 if vertex not found. Remove legacy links from Rest DocuBlocks. There are still some include DocuBlocks with old links, but they appear to be unused.
With BTS-309 fixed it's 400 if vertex coll not found, but still 400 if vertex not found. Remove legacy links from Rest DocuBlocks. There are still some include DocuBlocks with old links, but they appear to be unused.
From the 3.6 release notes:
It only says vertex collection here. Is it still a 404 error if the vertex document does not exist, or is it 400 in both cases, vertex collection or vertex document missing?
From
PATCH /_api/document
description:For the multi-document cases, it only says
... which is probably because an array is returned in all cases (may contain error codes, I assume 404 if a document wasn't found?)
Experiments
404 or 400 if vertex/edge collection is missing? (tested with 3.6.0-rc.1 gf7a295252a)
POST /_api/gharial/{graph}/edge
--> creates collectionsPUT /_api/gharial/{graph}/edge/{definition}
--> creates vertex collections, throws 404 if edge coll not foundPOST /_api/gharial/{graph}/edge/{collection}
--> 404 if vertex missing, 404 if vertex coll missing (with error collection 'edge coll' not found?!)DELETE /_api/gharial/{graph}/edge/{collection}/{edge}
--> 404 if edge not found (with error edge collection not used in graph?!), same erorr if edge coll is not foundPATCH /_api/gharial/{graph}/edge/{collection}/{edge}
--> changes _from/_to without checking if the vertex collection or vertex exists!!!PUT /_api/gharial/{graph}/edge/{collection}/{edge}
--> 404 if vertex not found, but 400 no collection name specified (?!) if vertex collection is missingGET /_api/gharial/{graph}/edge/{collection}/{edge}
--> 404 if edge not foundGET /_api/gharial/{graph}/vertex
--> 404 if graph not foundPOST /_api/gharial/{graph}/vertex
--> 500 VPack error with{}
body (probably other routes as well), 400 if already in use by graph (but with error collection used in orphans)DELETE /_api/gharial/{graph}/vertex/{collection}
--> 400 if coll is not part of graph (with error not in list of orphan collections),POST /_api/gharial/{graph}/vertex/{collection}
--> 404 collection or view not foundDELETE /_api/gharial/{graph}/vertex/{collection}/{vertex}
--> 404 collection or view not found if vertex collection is missing, 404 document not found if vertex is missingGET /_api/gharial/{graph}/vertex/{collection}/{vertex}
--> 404 collection or view not found if vertex collection is missing, 404 document not found if vertex is missingPATCH /_api/gharial/{graph}/vertex/{collection}/{vertex}
--> 404 collection or view not found if vertex collection is missing, 404 document not found if vertex is missingPUT /_api/gharial/{graph}/vertex/{collection}/{vertex}
--> 404 collection or view not found if vertex collection is missing, 404 document not found if vertex is missingsome of the error messages are misleading, but
PATCH /_api/gharial/{graph}/edge/{collection}/{edge}
not checking the_from
/_to
attribute whether the vertex document exists or not is a real bug.