Skip to content

Commit 31422bd

Browse files
committed
Replace local UnsupportedIntegrationError with shared error
Create a new shared UnsupportedIntegrationError in src/platform/errors to conform to the project error taxonomy. Replace the locally defined error in sqlIntegrationEnvironmentVariablesProvider.ts with the shared version. The shared error maintains the same behavior (BaseError with 'unknown' category) and accepts a message parameter to support both integration type and auth method error cases. All three throw sites (lines 76-78, 109-111, and 148-150) now use the shared error with appropriate messages for consistent telemetry and error handling across the codebase.
1 parent 56e9e91 commit 31422bd

File tree

2 files changed

+26
-17
lines changed

2 files changed

+26
-17
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
4+
import { BaseError } from './types';
5+
6+
/**
7+
* Error thrown when an unsupported integration type is encountered.
8+
*
9+
* Cause:
10+
* An integration configuration has a type that is not supported by the SQL integration system,
11+
* or an integration uses an authentication method that is not supported in VSCode.
12+
*
13+
* Handled by:
14+
* Callers should handle this error and inform the user that the integration type or
15+
* authentication method is not supported.
16+
*/
17+
export class UnsupportedIntegrationError extends BaseError {
18+
constructor(message: string) {
19+
super('unknown', message);
20+
}
21+
}
22+

src/platform/notebooks/deepnote/sqlIntegrationEnvironmentVariablesProvider.ts

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { CancellationToken, Event, EventEmitter, NotebookDocument, workspace } f
33

44
import { IDisposableRegistry, Resource } from '../../common/types';
55
import { EnvironmentVariables } from '../../common/variables/types';
6-
import { BaseError } from '../../errors/types';
6+
import { UnsupportedIntegrationError } from '../../errors/unsupportedIntegrationError';
77
import { logger } from '../../logging';
88
import { IIntegrationStorage, ISqlIntegrationEnvVarsProvider } from './types';
99
import {
@@ -14,21 +14,6 @@ import {
1414
isSupportedSnowflakeAuthMethod
1515
} from './integrationTypes';
1616

17-
/**
18-
* Error thrown when an unsupported integration type is encountered.
19-
*
20-
* Cause:
21-
* An integration configuration has a type that is not supported by the SQL integration system.
22-
*
23-
* Handled by:
24-
* Callers should handle this error and inform the user that the integration type is not supported.
25-
*/
26-
class UnsupportedIntegrationError extends BaseError {
27-
constructor(public readonly integrationType: string) {
28-
super('unknown', `Unsupported integration type: ${integrationType}`);
29-
}
30-
}
31-
3217
/**
3318
* Converts an integration ID to the environment variable name format expected by SQL blocks.
3419
* Example: 'my-postgres-db' -> 'SQL_MY_POSTGRES_DB'
@@ -160,7 +145,9 @@ function convertIntegrationConfigToJson(config: IntegrationConfig): string {
160145
}
161146

162147
default:
163-
throw new UnsupportedIntegrationError((config as IntegrationConfig).type);
148+
throw new UnsupportedIntegrationError(
149+
`Unsupported integration type: ${(config as IntegrationConfig).type}`
150+
);
164151
}
165152
}
166153

0 commit comments

Comments
 (0)