Skip to content

Commit

Permalink
fix: add error-handling to cache registry
Browse files Browse the repository at this point in the history
  • Loading branch information
wessberg committed Oct 13, 2020
1 parent 769c9e4 commit 3aef454
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 20 deletions.
16 changes: 0 additions & 16 deletions boxfile.yml

This file was deleted.

12 changes: 10 additions & 2 deletions src/service/registry/cache-registry/cache-registry-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,11 @@ export class CacheRegistryService implements ICacheRegistryService {
* @returns
*/
private async flushCache(): Promise<void> {
await this.fileSaver.remove(constant.path.cacheRoot);
try {
await this.fileSaver.remove(constant.path.cacheRoot);
} catch {
// The environment does not allow writing to the cache root
}
}

/**
Expand All @@ -269,7 +273,11 @@ export class CacheRegistryService implements ICacheRegistryService {
* @returns
*/
private async writeToCache(path: string, content: Buffer): Promise<void> {
await this.fileSaver.save(path, content);
try {
await this.fileSaver.save(path, content);
} catch {
// The environment does not allow writing to the cache root
}
}

/**
Expand Down
2 changes: 0 additions & 2 deletions test/server/setup.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import {container} from "../../src/services";
// @ts-ignore
import {chrome} from "useragent-generator";
import {IApiService} from "../../src/service/api/i-api-service";
import {ICacheRegistryService} from "../../src/service/registry/cache-registry/i-cache-registry-service";

Expand Down

0 comments on commit 3aef454

Please sign in to comment.