Skip to content

Commit

Permalink
fix: have to await for catch
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Selman <danscode@selman.org>
  • Loading branch information
dselman committed May 23, 2024
1 parent ac474be commit 479405a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/graphmodel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -579,10 +579,10 @@ export class GraphModel {
function: {
description: `Get a ${node.getName()} by id`,
name: `get_${node.getName().toLowerCase()}_by_id`,
function: ((args: { name: string }) => {
function: (async (args: { name: string }) => {
const { name } = args;
try {
return this.query(`MATCH (n:${node.getName()} WHERE n.identifier='${name}') RETURN n;`);
return await this.query(`MATCH (n:${node.getName()} WHERE n.identifier='${name}') RETURN n;`);
}
catch(err) {
return `An error occurred: ${err}`;
Expand All @@ -607,10 +607,10 @@ export class GraphModel {
function: {
description: `Get data from a natural language query`,
name: `chat_with_data`,
function: ((args: { query: string }) => {
function: (async (args: { query: string }) => {
const { query } = args;
try {
return this.chatWithData(query);
return await this.chatWithData(query);
}
catch(err) {
return `An error occurred: ${err}`;
Expand Down

0 comments on commit 479405a

Please sign in to comment.