Skip to content

Commit e9f31e6

Browse files
authored
Do not throw if the secrets manager is disabled (#16)
* Do not throw if secrets manager is disabled * Throw error only if the message is provided
1 parent 101d782 commit e9f31e6

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/manager.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,10 @@ export namespace SecretsManager {
253253
throw new Error('Secrets manager is locked, check errors.');
254254
}
255255
if (isDisabled('jupyter-secrets-manager:manager')) {
256-
lock('Secret registry is disabled.');
256+
// If the secrets manager is disabled, we need to lock the manager, but not
257+
// throw an error, to let the plugin get activated anyway.
258+
console.warn('Secrets manager is disabled.');
259+
lock();
257260
}
258261
if (isDisabled(id)) {
259262
lock(`Sign error: plugin ${id} is disabled.`);
@@ -293,9 +296,11 @@ namespace Private {
293296
*
294297
* @param message - the error message to throw.
295298
*/
296-
export function lock(message: string) {
299+
export function lock(message?: string): void {
297300
locked = true;
298-
throw new Error(message);
301+
if (message) {
302+
throw new Error(message);
303+
}
299304
}
300305

301306
/**

0 commit comments

Comments
 (0)