Skip to content

Commit 1b47c04

Browse files
author
Rares Cheseli
committed
update logs
1 parent ac7ac67 commit 1b47c04

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

packages/spacecat-shared-drs-client/src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ export default class DrsClient {
7777
constructor({ apiBaseUrl, apiKey }, log = console) {
7878
this.log = log;
7979
if (!isValidUrl(apiBaseUrl)) {
80-
throw this.#createError(`Invalid DRS API Base URL: ${apiBaseUrl}`, HTTP_BAD_REQUEST);
80+
throw this.#createError('Invalid or missing DRS API Base URL', HTTP_BAD_REQUEST);
8181
}
8282
if (!hasText(apiKey)) {
83-
throw this.#createError(`Invalid DRS API Key: ${apiKey}`, HTTP_BAD_REQUEST);
83+
throw this.#createError('Invalid or missing DRS API Key', HTTP_BAD_REQUEST);
8484
}
8585
this.apiBaseUrl = apiBaseUrl;
8686
this.apiKey = apiKey;

packages/spacecat-shared-drs-client/test/index.test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,19 +126,19 @@ describe('DrsClient', () => {
126126

127127
describe('constructor', () => {
128128
it('throws error when API base URL is missing', () => {
129-
expect(() => new DrsClient({ apiKey: API_KEY })).to.throw('Invalid DRS API Base URL: undefined');
129+
expect(() => new DrsClient({ apiKey: API_KEY })).to.throw('Invalid or missing DRS API Base URL');
130130
});
131131

132132
it('throws error when API base URL is invalid', () => {
133-
expect(() => new DrsClient({ apiBaseUrl: 'not-a-url', apiKey: API_KEY })).to.throw('Invalid DRS API Base URL: not-a-url');
133+
expect(() => new DrsClient({ apiBaseUrl: 'not-a-url', apiKey: API_KEY })).to.throw('Invalid or missing DRS API Base URL');
134134
});
135135

136136
it('throws error when API key is missing', () => {
137-
expect(() => new DrsClient({ apiBaseUrl: API_BASE_URL })).to.throw('Invalid DRS API Key: undefined');
137+
expect(() => new DrsClient({ apiBaseUrl: API_BASE_URL })).to.throw('Invalid or missing DRS API Key');
138138
});
139139

140140
it('throws error when API key is empty', () => {
141-
expect(() => new DrsClient({ apiBaseUrl: API_BASE_URL, apiKey: '' })).to.throw('Invalid DRS API Key: ');
141+
expect(() => new DrsClient({ apiBaseUrl: API_BASE_URL, apiKey: '' })).to.throw('Invalid or missing DRS API Key');
142142
});
143143

144144
it('creates client with valid config', () => {
@@ -193,7 +193,7 @@ describe('DrsClient', () => {
193193
log,
194194
};
195195

196-
expect(() => DrsClient.createFrom(context)).to.throw('Invalid DRS API Base URL: undefined');
196+
expect(() => DrsClient.createFrom(context)).to.throw('Invalid or missing DRS API Base URL');
197197
});
198198

199199
it('throws when DRS_API_KEY is missing from env', () => {
@@ -202,7 +202,7 @@ describe('DrsClient', () => {
202202
log,
203203
};
204204

205-
expect(() => DrsClient.createFrom(context)).to.throw('Invalid DRS API Key: undefined');
205+
expect(() => DrsClient.createFrom(context)).to.throw('Invalid or missing DRS API Key');
206206
});
207207
});
208208

0 commit comments

Comments
 (0)