Skip to content

Commit

Permalink
provide useful error for turso driver
Browse files Browse the repository at this point in the history
  • Loading branch information
invisal committed Oct 14, 2024
1 parent 0949040 commit caa8623
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/connections/sqlite/turso.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,20 @@ export class TursoConnection extends SqliteBaseConnection {
error: null,
query: query.query,
};
} catch {
return {
data: [],
error: new Error('Failed to execute query'),
query: query.query,
};
} catch (e) {
if (e instanceof Error) {
return {
data: [],
error: { message: e.message, name: e.name },
query: query.query,
};
} else {
return {
data: [],
error: { message: 'Unknown error', name: 'Unknown' },
query: query.query,
};
}
}
}

Expand Down

0 comments on commit caa8623

Please sign in to comment.