Skip to content

Commit d89025b

Browse files
authored
chore: rename exception to error (#388)
1 parent 0aae47e commit d89025b

35 files changed

Lines changed: 80 additions & 81 deletions

common/lib/authentication/aws_secrets_manager_plugin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export class AwsSecretsManagerPlugin extends AbstractConnectionPlugin {
123123
return await connectFunc();
124124
}
125125
}
126-
logger.debug(Messages.get("AwsSecretsManagerConnectionPlugin.unhandledException", error.name, error.message));
126+
logger.debug(Messages.get("AwsSecretsManagerConnectionPlugin.unhandledError", error.name, error.message));
127127
}
128128
throw error;
129129
}
@@ -149,7 +149,7 @@ export class AwsSecretsManagerPlugin extends AbstractConnectionPlugin {
149149
} else if (error instanceof Error && error.message.includes("AWS SDK error")) {
150150
logAndThrowError(Messages.get("AwsSecretsManagerConnectionPlugin.endpointOverrideInvalidConnection", error.message));
151151
} else {
152-
logAndThrowError(Messages.get("AwsSecretsManagerConnectionPlugin.unhandledException", error.message));
152+
logAndThrowError(Messages.get("AwsSecretsManagerConnectionPlugin.unhandledError", error.message));
153153
}
154154
}
155155
}

common/lib/authentication/iam_authentication_plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export class IamAuthenticationPlugin extends AbstractConnectionPlugin {
109109
try {
110110
return await connectFunc();
111111
} catch (e) {
112-
logger.debug(Messages.get("Authentication.connectException", (e as Error).message));
112+
logger.debug(Messages.get("Authentication.connectError", (e as Error).message));
113113
if (!this.pluginService.isLoginError(e as Error) || !isCachedToken) {
114114
throw e;
115115
}

common/lib/plugin_manager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ export class PluginManager {
321321
try {
322322
host = plugin.getHostInfoByStrategy(role, strategy, hosts);
323323
} catch (error) {
324-
// This plugin does not support the provided strategy, ignore the exception and move on
324+
// This plugin does not support the provided strategy, ignore the error and move on.
325325
}
326326
}
327327
}
@@ -338,7 +338,7 @@ export class PluginManager {
338338
return host;
339339
}
340340
} catch (error) {
341-
// This plugin does not support the provided strategy, ignore the exception and move on
341+
// This plugin does not support the provided strategy, ignore the error and move on.
342342
}
343343
}
344344
}

common/lib/plugins/efm/monitor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,11 @@ export class MonitorImpl implements Monitor {
207207
});
208208
}
209209
} catch (error: any) {
210-
logger.debug(Messages.get("MonitorImpl.exceptionDuringMonitoringContinue", error.message));
210+
logger.debug(Messages.get("MonitorImpl.errorDuringMonitoringContinue", error.message));
211211
}
212212
}
213213
} catch (error: any) {
214-
logger.debug(Messages.get("MonitorImpl.exceptionDuringMonitoringStop", error.message));
214+
logger.debug(Messages.get("MonitorImpl.errorDuringMonitoringStop", error.message));
215215
} finally {
216216
this.stopped = true;
217217
await this.endMonitoringClient();

common/lib/plugins/efm/monitor_connection_context.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export class MonitorConnectionContext {
7777
this.telemetryAbortedConnectionCounter.inc();
7878
} catch (error: any) {
7979
// ignore
80-
logger.debug(Messages.get("MonitorConnectionContext.exceptionAbortingConnection", error.message));
80+
logger.debug(Messages.get("MonitorConnectionContext.errorAbortingConnection", error.message));
8181
}
8282
this.abortedConnectionCounter++;
8383
}

common/lib/plugins/failover/failover_plugin.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ export class FailoverPlugin extends AbstractConnectionPlugin {
321321

322322
return await methodFunc();
323323
} catch (e: any) {
324-
logger.debug(Messages.get("Failover.detectedException", e.message));
324+
logger.debug(Messages.get("Failover.detectedError", e.message));
325325
if (this._lastError !== e && this.shouldErrorTriggerClientSwitch(e)) {
326326
await this.invalidateCurrentClient();
327327
const currentHostInfo = this.pluginService.getCurrentHostInfo();
@@ -368,7 +368,7 @@ export class FailoverPlugin extends AbstractConnectionPlugin {
368368
const result = await this._readerFailoverHandler.failover(this.pluginService.getHosts(), failedHost);
369369

370370
if (result) {
371-
const error = result.exception;
371+
const error = result.error;
372372
if (error) {
373373
throw error;
374374
}
@@ -424,7 +424,7 @@ export class FailoverPlugin extends AbstractConnectionPlugin {
424424
const result = await this._writerFailoverHandler.failover(this.pluginService.getHosts());
425425

426426
if (result) {
427-
const error = result.exception;
427+
const error = result.error;
428428
if (error) {
429429
throw error;
430430
}

common/lib/plugins/failover/reader_failover_handler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export class ClusterAwareReaderFailoverHandler implements ReaderFailoverHandler
148148
// submit connection attempt tasks in batches of 2
149149
try {
150150
const result = await this.getResultFromNextTaskBatch(hosts, i, failoverTaskId);
151-
if (result && (result.isConnected || result.exception)) {
151+
if (result && (result.isConnected || result.error)) {
152152
return result;
153153
}
154154
} catch (error) {
@@ -326,7 +326,7 @@ class ConnectionAttemptTask {
326326
} catch (error) {
327327
this.pluginService.setAvailability(this.newHost.allAliases, HostAvailability.NOT_AVAILABLE);
328328
if (error instanceof Error) {
329-
// Propagate exceptions that are not caused by network errors.
329+
// Propagate errors that are not caused by network errors.
330330
if (!this.pluginService.isNetworkError(error)) {
331331
return new ReaderFailoverResult(null, null, false, error, this.taskId);
332332
}

common/lib/plugins/failover/reader_failover_result.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ export class ReaderFailoverResult {
2121
readonly client: ClientWrapper | null;
2222
readonly newHost: HostInfo | null;
2323
readonly isConnected: boolean;
24-
readonly exception?: Error;
24+
readonly error?: Error;
2525
readonly taskId?: number;
2626

27-
constructor(client: ClientWrapper | null, newHost: HostInfo | null, isConnected: boolean, exception?: Error, taskId?: number) {
27+
constructor(client: ClientWrapper | null, newHost: HostInfo | null, isConnected: boolean, error?: Error, taskId?: number) {
2828
this.client = client;
2929
this.newHost = newHost;
3030
this.isConnected = isConnected;
31-
this.exception = exception;
31+
this.error = error;
3232
this.taskId = taskId;
3333
}
3434
}

common/lib/plugins/failover/writer_failover_handler.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export class ClusterAwareWriterFailoverHandler implements WriterFailoverHandler
113113
.then((result) => {
114114
selectedTask = result.taskName;
115115
// If the first resolved promise is connected or has an error, return it.
116-
if (result.isConnected || result.exception || singleTask) {
116+
if (result.isConnected || result.error || singleTask) {
117117
return result;
118118
}
119119

@@ -239,9 +239,9 @@ class ReconnectToWriterHandlerTask {
239239
await this.pluginService.forceRefreshHostList(this.currentClient);
240240
latestTopology = this.pluginService.getHosts();
241241
} catch (error) {
242-
// Propagate exceptions that are not caused by network errors.
242+
// Propagate errors that are not caused by network errors.
243243
if (error instanceof AwsWrapperError && !this.pluginService.isNetworkError(error)) {
244-
logger.info(Messages.get("ClusterAwareWriterFailoverHandler.taskAEncounteredException", error.message));
244+
logger.info(Messages.get("ClusterAwareWriterFailoverHandler.taskAEncounteredError", error.message));
245245
return new WriterFailoverResult(false, false, [], ClusterAwareWriterFailoverHandler.RECONNECT_WRITER_TASK, null, error);
246246
}
247247
}
@@ -342,7 +342,7 @@ class WaitForNewWriterHandlerTask {
342342

343343
return new WriterFailoverResult(true, true, this.currentTopology, ClusterAwareWriterFailoverHandler.WAIT_NEW_WRITER_TASK, this.currentClient);
344344
} catch (error: any) {
345-
logger.error(Messages.get("ClusterAwareWriterFailoverHandler.taskBEncounteredException", error.message));
345+
logger.error(Messages.get("ClusterAwareWriterFailoverHandler.taskBEncounteredError", error.message));
346346
throw error;
347347
} finally {
348348
logger.info(Messages.get("ClusterAwareWriterFailoverHandler.taskBFinished"));
@@ -410,7 +410,7 @@ class WaitForNewWriterHandlerTask {
410410
}
411411
}
412412
} catch (error: any) {
413-
logger.info(Messages.get("ClusterAwareWriterFailoverHandler.taskBEncounteredException", error.message));
413+
logger.info(Messages.get("ClusterAwareWriterFailoverHandler.taskBEncounteredError", error.message));
414414
return false;
415415
}
416416

common/lib/plugins/failover/writer_failover_result.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ export class WriterFailoverResult {
2323
readonly topology: HostInfo[];
2424
readonly client: ClientWrapper | null;
2525
readonly taskName: string;
26-
readonly exception: Error | undefined;
26+
readonly error: Error | undefined;
2727

28-
constructor(isConnected: boolean, isNewHost: boolean, topology: HostInfo[], taskName: string, client: ClientWrapper | null, exception?: Error) {
28+
constructor(isConnected: boolean, isNewHost: boolean, topology: HostInfo[], taskName: string, client: ClientWrapper | null, error?: Error) {
2929
this.isConnected = isConnected;
3030
this.isNewHost = isNewHost;
3131
this.topology = topology;
3232
this.client = client;
3333
this.taskName = taskName;
34-
this.exception = exception;
34+
this.error = error;
3535
}
3636
}

0 commit comments

Comments
 (0)