Skip to content

Commit b6d8d76

Browse files
committed
fix empty start
1 parent 68796fe commit b6d8d76

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

helpers/clients.js

+13-5
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,20 @@ const api = axios.create();
77
const setupClient = (argv) => {
88
const apiPrefix = 'api/v1';
99
const { endpoint, rejectUnauthorized, dataSourcePathPrefix } = argv || {};
10+
if (!endpoint) {
11+
return;
12+
}
1013
const tmp = pathLib.join(dataSourcePathPrefix, apiPrefix);
11-
const baseURL = new URL(tmp, endpoint);
12-
api.defaults.baseURL = baseURL.toString();
13-
if (baseURL.protocol === 'https:') {
14-
const agent = new https.Agent({ rejectUnauthorized });
15-
api.defaults.httpsAgent = agent;
14+
try {
15+
const baseURL = new URL(tmp, endpoint);
16+
api.defaults.baseURL = baseURL.toString();
17+
if (baseURL.protocol === 'https:') {
18+
const agent = new https.Agent({ rejectUnauthorized });
19+
api.defaults.httpsAgent = agent;
20+
}
21+
}
22+
catch (error) {
23+
console.error(error);
1624
}
1725
};
1826

0 commit comments

Comments
 (0)