Converting remaining services to use runWithErrorHandling() (#22720)

* Converting remaining services to use `runWithErrorHandling()`

* Updating sqlops-dataprotocolclient to 1.3.3

* upgrading dataprotocol and swapping to that baseService

* Adding async to make thenable -> promise conversion happy

---------

Co-authored-by: Alan Ren <alanren@microsoft.com>
This commit is contained in:
Benjin Dubishar
2023-04-14 16:08:07 -07:00
committed by GitHub
parent 47bf7efd4a
commit b1c2cc1740
22 changed files with 155 additions and 355 deletions

View File

@@ -4,23 +4,19 @@
*--------------------------------------------------------------------------------------------*/
import type * as mssql from 'mssql';
import { SqlOpsDataClient } from 'dataprotocol-client';
import * as contracts from '../contracts';
import { BaseService, SqlOpsDataClient } from 'dataprotocol-client';
export class AzureBlobService implements mssql.IAzureBlobService {
export class AzureBlobService extends BaseService implements mssql.IAzureBlobService {
public constructor(protected readonly client: SqlOpsDataClient) { }
public constructor(client: SqlOpsDataClient) {
super(client);
}
public async createSas(ownerUri: string, blobContainerUri: string, blobContainerKey: string, storageAccountName: string, expirationDate: string): Promise<mssql.CreateSasResponse> {
// This isn't registered as a feature since it's not something that we expect every tools client to implement currently since the usage is
// specifically for ADS and SqlToolsService.
const params: contracts.CreateSasParams = { ownerUri, blobContainerUri, blobContainerKey, storageAccountName, expirationDate };
return this.client.sendRequest(contracts.CreateSasRequest.type, params).then(
undefined,
e => {
this.client.logFailedRequest(contracts.CreateSasRequest.type, e);
return Promise.reject(e);
}
);
return this.runWithErrorHandling(contracts.CreateSasRequest.type, params);
}
}