mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-20 16:42:56 +00:00
refactor: update all
This commit is contained in:
committed by
Rainer Killinger
parent
8cb4ee12a6
commit
26c14fa7e9
17
src/e2e.ts
17
src/e2e.ts
@@ -103,15 +103,14 @@ function compareItems() {
|
||||
* Function to add all the SCThings that getItemsFromSamples() returns to the backend
|
||||
*/
|
||||
async function indexSamples(api: ConnectorClient, options: E2EOptions): Promise<void> {
|
||||
|
||||
const items = await getItemsFromSamples(options.samplesLocation);
|
||||
|
||||
if (items.length === 0) {
|
||||
throw new Error('Could not index samples. None were retrieved from the file system.');
|
||||
}
|
||||
|
||||
try {
|
||||
// sort items by type
|
||||
const items = await getItemsFromSamples(options.samplesLocation);
|
||||
|
||||
if (items.length === 0) {
|
||||
throw new Error('Could not index samples. None were retrieved from the file system.');
|
||||
}
|
||||
|
||||
// sort items by type
|
||||
const itemMap: Map<SCThingType, SCThings[]> = new Map();
|
||||
for (const item of items) {
|
||||
if (!itemMap.has(item.type)) {
|
||||
@@ -155,7 +154,7 @@ export async function getItemsFromSamples<T extends SCThings>(samplesDirectory:
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
return error;
|
||||
throw error;
|
||||
}
|
||||
|
||||
return things;
|
||||
|
||||
@@ -73,11 +73,13 @@ export class HttpClient {
|
||||
try {
|
||||
response = await got(requestConfig.url.toString(), params);
|
||||
} catch (err) {
|
||||
if (typeof err.response === 'undefined') {
|
||||
// tslint:disable-next-line: no-any
|
||||
if (typeof (err as any).response === 'undefined') {
|
||||
throw err;
|
||||
}
|
||||
// if there is a response (e.g. response with statusCode 404 etc.) provide it
|
||||
response = err.response;
|
||||
// tslint:disable-next-line: no-any
|
||||
response = (err as any).response as Response<TYPE_OF_BODY>;
|
||||
}
|
||||
|
||||
return response;
|
||||
|
||||
@@ -208,7 +208,7 @@ export abstract class Plugin {
|
||||
* @param req An express Request from the backend
|
||||
* @param res An express Response to the backend for you to send back data
|
||||
*/
|
||||
protected abstract async onRouteInvoke(req: express.Request, res: express.Response): Promise<void>;
|
||||
protected abstract onRouteInvoke(req: express.Request, res: express.Response): Promise<void>;
|
||||
|
||||
/**
|
||||
* Closes the server
|
||||
@@ -222,9 +222,9 @@ export abstract class Plugin {
|
||||
/* istanbul ignore next */
|
||||
if (typeof err !== 'undefined') {
|
||||
/* istanbul ignore next */
|
||||
return reject(err);
|
||||
reject(err);
|
||||
}
|
||||
resolve();
|
||||
resolve(undefined);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user