Skip to content

Commit 5b1f5a7

Browse files
committed
misc: change some errors to warnings
1 parent 435affe commit 5b1f5a7

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

Diff for: src/lib/alt-ips.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import createHttpError from 'http-errors';
77
import { scopedLogger } from './logger.js';
88
import GeoIpClient, { getGeoIpClient } from './geoip/client.js';
99
import { isIpPrivate } from './private-ip.js';
10+
import { ProbeError } from './probe-error.js';
1011

1112
const getRandomBytes = promisify(randomBytes);
1213
const logger = scopedLogger('alt-ips');
@@ -159,7 +160,12 @@ export class AltIps {
159160
return false;
160161
}
161162
} catch (e) {
162-
logger.error('Failed to add an alt IP', e);
163+
if (e instanceof ProbeError) {
164+
logger.warn('Failed to add an alt IP.', e);
165+
} else {
166+
logger.error('Failed to add an alt IP.', e);
167+
}
168+
163169
return false;
164170
}
165171

@@ -169,7 +175,7 @@ export class AltIps {
169175

170176
private subscribeToNodeMessages () {
171177
this.syncedProbeList.subscribeToNodeMessages<AltIpReqBody>(ALT_IP_REQ_MESSAGE_TYPE, (reqMessage: PubSubMessage<AltIpReqBody>) => {
172-
this.validateTokenFromPubSub(reqMessage).catch(error => logger.error('failed to validate token from pub/sub', error));
178+
this.validateTokenFromPubSub(reqMessage).catch(error => logger.error('Failed to validate token from pub/sub.', error));
173179
});
174180

175181
this.syncedProbeList.subscribeToNodeMessages<AltIpResBody>(ALT_IP_RES_MESSAGE_TYPE, this.handleRes);

Diff for: src/lib/ws/middleware/probe-metadata.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ export const probeMetadata = errorHandler(async (socket: ServerSocket, next: (er
1616
next();
1717
} catch (error: unknown) {
1818
let message = 'failed to collect probe metadata';
19-
logger.error(message, error);
2019

2120
if (error instanceof ProbeError) {
2221
message = error.message;
22+
logger.warn(message, error);
23+
} else {
24+
logger.error(message, error);
2325
}
2426

2527
throw new WsError(message, {

0 commit comments

Comments
 (0)