diff --git a/ChangeLog.md b/ChangeLog.md index 86b58d83..0718134f 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -4,6 +4,7 @@ Starting with v1.31.6, this file will contain a record of major features and upd ## Upcoming - Added `--connected-table` option to magics with table widget output ([Link to PR](https://github.com/aws/graph-notebook/pull/634)) +- Changed `%%gremlin --store-to` to also store exceptions from non-Neptune queries ([Link to PR](https://github.com/aws/graph-notebook/pull/635)) - Fixed broken `--help` option for `%%gremlin` ([Link to PR](https://github.com/aws/graph-notebook/pull/630)) - Fixed openCypher query bug regression in the [`01-About-the-Neptune-Notebook`](https://github.com/aws/graph-notebook/blob/main/src/graph_notebook/notebooks/01-Getting-Started/01-About-the-Neptune-Notebook.ipynb) sample ([Link to PR](https://github.com/aws/graph-notebook/pull/631)) - Fixed `%%graph_notebook_config` error when excluding optional Gremlin section ([Link to PR](https://github.com/aws/graph-notebook/pull/633)) diff --git a/src/graph_notebook/magics/graph_magic.py b/src/graph_notebook/magics/graph_magic.py index 05119848..661a1b92 100644 --- a/src/graph_notebook/magics/graph_magic.py +++ b/src/graph_notebook/magics/graph_magic.py @@ -1216,7 +1216,11 @@ def gremlin(self, line, cell, local_ns: dict = None): print("%%gremlin is incompatible with Neptune Analytics.") raise e else: - query_res = self.client.gremlin_query(cell, transport_args=transport_args) + try: + query_res = self.client.gremlin_query(cell, transport_args=transport_args) + except Exception as e: + store_to_ns(args.store_to, {'error': str(e)[5:]}, local_ns) # remove the leading error code. + raise e query_time = time.time() * 1000 - query_start if not args.silent: gremlin_metadata = build_gremlin_metadata_from_query(query_type='query', results=query_res,