@candlerip/shared3 0.0.123 → 0.0.124
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
+
import { ProjectName } from '../../../project/index.js';
|
1
2
|
import { CustomError } from '../type.js';
|
2
3
|
import { Info, Message } from './type.js';
|
3
4
|
export declare const customErrorWorker: (info?: Info) => {
|
4
5
|
addInfo: (info?: Info) => void;
|
5
6
|
composeCustomError: (message: Message, info?: Info) => CustomError;
|
7
|
+
setProjectName: (projectName: ProjectName) => void;
|
6
8
|
};
|
@@ -2,18 +2,23 @@ import { ProjectSingleton } from '../../../project/index.js';
|
|
2
2
|
import { composeCustomError as composeCustomErrorFunc } from '../compose-custom-error/index.js';
|
3
3
|
export const customErrorWorker = (info) => {
|
4
4
|
let _info = info;
|
5
|
+
let _projectName;
|
5
6
|
const addInfo = (info) => {
|
6
7
|
_info = {
|
7
8
|
..._info,
|
8
9
|
...info,
|
9
10
|
};
|
10
11
|
};
|
11
|
-
const composeCustomError = (message, info) => composeCustomErrorFunc(message, ProjectSingleton.getProjectName(), {
|
12
|
+
const composeCustomError = (message, info) => composeCustomErrorFunc(message, _projectName ?? ProjectSingleton.getProjectName(), {
|
12
13
|
..._info,
|
13
14
|
...info,
|
14
15
|
});
|
16
|
+
const setProjectName = (projectName) => {
|
17
|
+
_projectName = projectName;
|
18
|
+
};
|
15
19
|
return {
|
16
20
|
addInfo,
|
17
21
|
composeCustomError,
|
22
|
+
setProjectName,
|
18
23
|
};
|
19
24
|
};
|