Use return await to catch exceptions (#6109)

So the exceptions are handled properly and filtered in sentry
This commit is contained in:
Thomas Trompette
2024-07-03 11:14:28 +02:00
committed by GitHub
parent 5b26452649
commit 4183e5460d
5 changed files with 38 additions and 20 deletions

View File

@ -26,7 +26,10 @@ export class RemoteServerResolver {
@AuthWorkspace() { id: workspaceId }: Workspace,
) {
try {
return this.remoteServerService.createOneRemoteServer(input, workspaceId);
return await this.remoteServerService.createOneRemoteServer(
input,
workspaceId,
);
} catch (error) {
remoteServerGraphqlApiExceptionHandler(error);
}
@ -38,7 +41,10 @@ export class RemoteServerResolver {
@AuthWorkspace() { id: workspaceId }: Workspace,
) {
try {
return this.remoteServerService.updateOneRemoteServer(input, workspaceId);
return await this.remoteServerService.updateOneRemoteServer(
input,
workspaceId,
);
} catch (error) {
remoteServerGraphqlApiExceptionHandler(error);
}
@ -50,7 +56,10 @@ export class RemoteServerResolver {
@AuthWorkspace() { id: workspaceId }: Workspace,
) {
try {
return this.remoteServerService.deleteOneRemoteServer(id, workspaceId);
return await this.remoteServerService.deleteOneRemoteServer(
id,
workspaceId,
);
} catch (error) {
remoteServerGraphqlApiExceptionHandler(error);
}
@ -62,7 +71,7 @@ export class RemoteServerResolver {
@AuthWorkspace() { id: workspaceId }: Workspace,
) {
try {
return this.remoteServerService.findOneByIdWithinWorkspace(
return await this.remoteServerService.findOneByIdWithinWorkspace(
id,
workspaceId,
);
@ -78,7 +87,7 @@ export class RemoteServerResolver {
@AuthWorkspace() { id: workspaceId }: Workspace,
) {
try {
return this.remoteServerService.findManyByTypeWithinWorkspace(
return await this.remoteServerService.findManyByTypeWithinWorkspace(
foreignDataWrapperType,
workspaceId,
);

View File

@ -21,7 +21,7 @@ export class RemoteTableResolver {
@AuthWorkspace() { id: workspaceId }: Workspace,
) {
try {
return this.remoteTableService.findDistantTablesWithStatus(
return await this.remoteTableService.findDistantTablesWithStatus(
input.id,
workspaceId,
input.shouldFetchPendingSchemaUpdates,
@ -37,7 +37,7 @@ export class RemoteTableResolver {
@AuthWorkspace() { id: workspaceId }: Workspace,
) {
try {
return this.remoteTableService.syncRemoteTable(input, workspaceId);
return await this.remoteTableService.syncRemoteTable(input, workspaceId);
} catch (error) {
remoteTableGraphqlApiExceptionHandler(error);
}
@ -49,7 +49,10 @@ export class RemoteTableResolver {
@AuthWorkspace() { id: workspaceId }: Workspace,
) {
try {
return this.remoteTableService.unsyncRemoteTable(input, workspaceId);
return await this.remoteTableService.unsyncRemoteTable(
input,
workspaceId,
);
} catch (error) {
remoteTableGraphqlApiExceptionHandler(error);
}
@ -61,7 +64,7 @@ export class RemoteTableResolver {
@AuthWorkspace() { id: workspaceId }: Workspace,
) {
try {
return this.remoteTableService.syncRemoteTableSchemaChanges(
return await this.remoteTableService.syncRemoteTableSchemaChanges(
input,
workspaceId,
);