-
Couldn't load subscription status.
- Fork 326
-
As mentioned above I am trying to show explain statement in case sql has timed out. But currently having problem making this work. Currently managed to create wrapper:
const pgSql = postgres({
...params
})
const sqlWrapper = (strings: any, ...args: any[]): any => {
return pgSql(strings, ...args);
};
Object.assign(sqlWrapper, pgSql);
export const sql: postgres.Sql<
Record<string, postgres.PostgresType> extends Record<string, postgres.PostgresType>
? {}
: {
[type in keyof Record<string, postgres.PostgresType>]: Record<string, postgres.PostgresType>[type] extends {
serialize: (value: infer R) => any;
parse: (raw: any) => infer R;
}
? R
: never;
}
> = sqlWrapper as postgres.Sql<
Record<string, postgres.PostgresType> extends Record<string, postgres.PostgresType>
? {}
: {
[type in keyof Record<string, postgres.PostgresType>]: Record<string, postgres.PostgresType>[type] extends {
serialize: (value: infer R) => any;
parse: (raw: any) => infer R;
}
? R
: never;
}
>;
But I could not catch timeout errors with try catch inside sqlWrapper. As I understand, timeout error would only be available outside in await sql. Is there any way to catch this error inside wrapper? Thanks a lot
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment