Skip to content

Commit

Permalink
Merge pull request #132 from celonis/exception-handler-on-batch-packa…
Browse files Browse the repository at this point in the history
…ge-import

exception handler on batch package import
  • Loading branch information
frkntrcnn authored Jul 25, 2023
2 parents 5642327 + dac1d06 commit 780da4e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@celonis/content-cli",
"version": "0.4.1",
"version": "0.4.2",
"description": "CLI Tool to help manage content in Celonis EMS",
"main": "content-cli.js",
"bin": {
Expand Down
11 changes: 3 additions & 8 deletions src/api/space-api.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
import {
ContentNodeTransport,
PackageHistoryTransport,
PackageWithVariableAssignments
} from "../interfaces/package-manager.interfaces";
import {httpClientV2} from "../services/http-client-service.v2";
import {FatalError} from "../util/logger";
import {SpaceTransport} from "../interfaces/save-space.interface";
Expand All @@ -12,19 +7,19 @@ class SpaceApi {

public async findOne(spaceId: string): Promise<SpaceTransport> {
return httpClientV2.get(`/package-manager/api/spaces/${spaceId}`).catch(e => {
throw new FatalError(`Problem getting packages: ${e}`);
throw new FatalError(`Problem getting space: ${spaceId} ${e}`);
});
}

public async findAllSpaces(): Promise<SpaceTransport[]> {
return httpClientV2.get("/package-manager/api/spaces").catch(e => {
throw new FatalError(`Problem getting packages: ${e}`);
throw new FatalError(`Problem getting spaces: ${e}`);
});
}

public async createSpace(space: SpaceTransport): Promise<SpaceTransport> {
return httpClientV2.post("/package-manager/api/spaces", space).catch(e => {
throw new FatalError(`Problem getting packages: ${e}`);
throw new FatalError(`Problem space creation: ${e}`);
});
}

Expand Down
6 changes: 5 additions & 1 deletion src/services/package-manager/package-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,11 @@ class PackageService {
const versionsOfPackage = [...packageToImport.dependenciesByVersion.keys()].sort((k1, k2) => this.compareVersions(k1, k2)).filter(version => !importedPackageVersion.includes(version));

for (const version of versionsOfPackage) {
await this.importPackageVersion(packageToImport, manifestNodes, sourceToTargetVersionsByNodeKey, spaceMappings, importedVersionsByNodeKey, draftIdsByPackageKeyAndVersion, importedFilePath, version);
try {
await this.importPackageVersion(packageToImport, manifestNodes, sourceToTargetVersionsByNodeKey, spaceMappings, importedVersionsByNodeKey, draftIdsByPackageKeyAndVersion, importedFilePath, version);
} catch (e) {
logger.error(`Problem import package with key: ${packageToImport.packageKey} ${version} ${e}`);
}
}
}

Expand Down

0 comments on commit 780da4e

Please sign in to comment.