Add additional logging to spark command failures (#12706) (#12761)

This commit is contained in:
Charles Gagnon
2020-10-06 11:47:06 -07:00
committed by GitHub
parent 5b7a7c9865
commit b054295eac
2 changed files with 21 additions and 7 deletions

View File

@@ -232,7 +232,7 @@ export class MssqlObjectExplorerNodeProvider extends ProviderBase implements azd
return node;
}
public findSqlClusterSessionBySqlConnProfile(connectionProfile: azdata.IConnectionProfile): SqlClusterSession {
public findSqlClusterSessionBySqlConnProfile(connectionProfile: azdata.IConnectionProfile): SqlClusterSession | undefined {
for (let session of this.clusterSessionMap.values()) {
if (session.isMatchedSqlConnection(connectionProfile)) {
return session;

View File

@@ -21,9 +21,12 @@ const localize = nls.loadMessageBundle();
export async function findSqlClusterConnection(
obj: ICommandObjectExplorerContext | azdata.IConnectionProfile,
appContext: AppContext): Promise<SqlClusterConnection> {
appContext: AppContext): Promise<SqlClusterConnection | undefined> {
if (!obj || !appContext) { return undefined; }
if (!obj || !appContext) {
console.error('SqlClusterLookup::findSqlClusterConnection - No context available');
return undefined;
}
let sqlConnProfile: azdata.IConnectionProfile;
if ('type' in obj && obj.type === constants.ObjectExplorerService
@@ -36,18 +39,29 @@ export async function findSqlClusterConnection(
let sqlClusterConnection: SqlClusterConnection = undefined;
if (sqlConnProfile) {
sqlClusterConnection = await findSqlClusterConnectionBySqlConnProfile(sqlConnProfile, appContext);
} else {
console.error('SqlClusterLookup::findSqlClusterConnection - No connection profile');
}
return sqlClusterConnection;
}
async function findSqlClusterConnectionBySqlConnProfile(sqlConnProfile: azdata.IConnectionProfile, appContext: AppContext): Promise<SqlClusterConnection> {
if (!sqlConnProfile || !appContext) { return undefined; }
async function findSqlClusterConnectionBySqlConnProfile(sqlConnProfile: azdata.IConnectionProfile, appContext: AppContext): Promise<SqlClusterConnection | undefined> {
if (!sqlConnProfile || !appContext) {
console.error('SqlClusterLookup::findSqlClusterConnectionBySqlConnProfile - No context available');
return undefined;
}
let sqlOeNodeProvider = appContext.getService<MssqlObjectExplorerNodeProvider>(constants.ObjectExplorerService);
if (!sqlOeNodeProvider) { return undefined; }
if (!sqlOeNodeProvider) {
console.error('SqlClusterLookup::findSqlClusterConnectionBySqlConnProfile - No OE Node Provider available');
return undefined;
}
let sqlClusterSession = sqlOeNodeProvider.findSqlClusterSessionBySqlConnProfile(sqlConnProfile);
if (!sqlClusterSession) { return undefined; }
if (!sqlClusterSession) {
console.error('SqlClusterLookup::findSqlClusterConnectionBySqlConnProfile - No SQL Cluster Session found');
return undefined;
}
return sqlClusterSession.getSqlClusterConnection();
}