Skip to content

Commit 1b212bd

Browse files
committed
convert base error to custom
1 parent 0bad9cd commit 1b212bd

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/platform/notebooks/deepnote/sqlIntegrationEnvironmentVariablesProvider.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,26 @@ 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';
67
import { logger } from '../../logging';
78
import { IIntegrationStorage, ISqlIntegrationEnvVarsProvider } from './types';
89
import { DATAFRAME_SQL_INTEGRATION_ID, IntegrationConfig, IntegrationType } from './integrationTypes';
910

11+
/**
12+
* Error thrown when an unsupported integration type is encountered.
13+
*
14+
* Cause:
15+
* An integration configuration has a type that is not supported by the SQL integration system.
16+
*
17+
* Handled by:
18+
* Callers should handle this error and inform the user that the integration type is not supported.
19+
*/
20+
class UnsupportedIntegrationError extends BaseError {
21+
constructor(public readonly integrationType: string) {
22+
super('unknown', `Unsupported integration type: ${integrationType}`);
23+
}
24+
}
25+
1026
/**
1127
* Converts an integration ID to the environment variable name format expected by SQL blocks.
1228
* Example: 'my-postgres-db' -> 'SQL_MY_POSTGRES_DB'
@@ -58,7 +74,7 @@ function convertIntegrationConfigToJson(config: IntegrationConfig): string {
5874
}
5975

6076
default:
61-
throw new Error(`Unsupported integration type: ${(config as IntegrationConfig).type}`);
77+
throw new UnsupportedIntegrationError((config as IntegrationConfig).type);
6278
}
6379
}
6480

0 commit comments

Comments
 (0)