From 863b5e8ef5cdd7e38eec40d78999175c3415c776 Mon Sep 17 00:00:00 2001 From: Gabor Szabo Date: Thu, 14 May 2026 14:33:29 +0300 Subject: [PATCH 1/2] docs: Make example run smoothly by catching exception `g.delete()` raises exception if the graph does not exist. Having such an example on the front page is not very welcoming. Catching the exception and sweeping under the carpet solves this. Reported as #481 --- index.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/index.md b/index.md index 4af90974..2a28f6e2 100644 --- a/index.md +++ b/index.md @@ -74,7 +74,11 @@ db = FalkorDB(host='localhost', port=6379) # Create the 'MotoGP' graph g = db.select_graph('MotoGP') # Clear out this graph in case you've run this script before. -g.delete() +try: + g.delete() +except Exception: + # Graph doesn't exist yet, which is fine + pass g.query("""CREATE (:Rider {name:'Valentino Rossi'})-[:rides]->(:Team {name:'Yamaha'}), (:Rider {name:'Dani Pedrosa'})-[:rides]->(:Team {name:'Honda'}), From 6937c073da21d2b28fd06d5251dba32b603a6435 Mon Sep 17 00:00:00 2001 From: Gabor Szabo Date: Mon, 18 May 2026 19:34:21 +0300 Subject: [PATCH 2/2] catch the more specific redis.exceptions.ResponseError exception --- index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.md b/index.md index 2a28f6e2..5f3f3b04 100644 --- a/index.md +++ b/index.md @@ -76,7 +76,7 @@ g = db.select_graph('MotoGP') # Clear out this graph in case you've run this script before. try: g.delete() -except Exception: +except redis.exceptions.ResponseError: # Graph doesn't exist yet, which is fine pass g.query("""CREATE