repositories
/
e-mobility-charging-stations-simulator.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
refactor: applied changes for pull request
[e-mobility-charging-stations-simulator.git]
/
src
/
performance
/
storage
/
JsonFileStorage.ts
diff --git
a/src/performance/storage/JsonFileStorage.ts
b/src/performance/storage/JsonFileStorage.ts
index 87c12537e78310bf76a6cb52a8ca8ef2b52128ec..2a712a6008f61722ef21dddaac5acd2e3ba14d53 100644
(file)
--- a/
src/performance/storage/JsonFileStorage.ts
+++ b/
src/performance/storage/JsonFileStorage.ts
@@
-3,9
+3,10
@@
import fs from 'node:fs';
import path from 'node:path';
import fs from 'node:fs';
import path from 'node:path';
+import { Storage } from './Storage';
+import { BaseError } from '../../exception';
import { FileType, type Statistics } from '../../types';
import { FileType, type Statistics } from '../../types';
-import { AsyncLock, AsyncLockType, Constants, FileUtils, Utils } from '../../utils';
-import { Storage } from '../internal';
+import { AsyncLock, AsyncLockType, Constants, ErrorUtils, Utils } from '../../utils';
export class JsonFileStorage extends Storage {
private fd: number | null = null;
export class JsonFileStorage extends Storage {
private fd: number | null = null;
@@
-31,7
+32,7
@@
export class JsonFileStorage extends Storage {
);
})
.catch((error) => {
);
})
.catch((error) => {
-
File
Utils.handleFileException(
+
Error
Utils.handleFileException(
this.dbName,
FileType.PerformanceRecords,
error as NodeJS.ErrnoException,
this.dbName,
FileType.PerformanceRecords,
error as NodeJS.ErrnoException,
@@
-52,7
+53,7
@@
export class JsonFileStorage extends Storage {
this.fd = fs.openSync(this.dbName, 'a+');
}
} catch (error) {
this.fd = fs.openSync(this.dbName, 'a+');
}
} catch (error) {
-
File
Utils.handleFileException(
+
Error
Utils.handleFileException(
this.dbName,
FileType.PerformanceRecords,
error as NodeJS.ErrnoException,
this.dbName,
FileType.PerformanceRecords,
error as NodeJS.ErrnoException,
@@
-68,7
+69,7
@@
export class JsonFileStorage extends Storage {
this.fd = null;
}
} catch (error) {
this.fd = null;
}
} catch (error) {
-
File
Utils.handleFileException(
+
Error
Utils.handleFileException(
this.dbName,
FileType.PerformanceRecords,
error as NodeJS.ErrnoException,
this.dbName,
FileType.PerformanceRecords,
error as NodeJS.ErrnoException,
@@
-79,7
+80,7
@@
export class JsonFileStorage extends Storage {
private checkPerformanceRecordsFile(): void {
if (!this?.fd) {
private checkPerformanceRecordsFile(): void {
if (!this?.fd) {
- throw new Error(
+ throw new
Base
Error(
`${this.logPrefix} Performance records '${this.dbName}' file descriptor not found`
);
}
`${this.logPrefix} Performance records '${this.dbName}' file descriptor not found`
);
}