Skip to content

Commit

Permalink
Better import debug (#523)
Browse files Browse the repository at this point in the history
* chore(lib): add logging to import

* refactor(config): improve invalid module message

* test(lib): fix strings
  • Loading branch information
narekhovhannisyan authored Mar 13, 2024
1 parent 39c5c7a commit ab95a78
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/__tests__/unit/config/strings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('config/strings: ', () => {
it('successfully appends given param to message.', () => {
const param = 'mock-param';

const expectedMessage = `Provided module path: '${param}' is invalid or not found.`;
const expectedMessage = `Provided module: '${param}' is invalid or not found.`;

expect(INVALID_MODULE_PATH(param)).toEqual(expectedMessage);
});
Expand Down
2 changes: 1 addition & 1 deletion src/config/strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Impact Framework is an alpha release from the Green Software Foundation and is r
https://github.com/Green-Software-Foundation/if/issues/new?assignees=&labels=feedback&projects=&template=feedback.md&title=Feedback+-+
`,
INVALID_MODULE_PATH: (path: string) =>
`Provided module path: '${path}' is invalid or not found.`,
`Provided module: '${path}' is invalid or not found.`,
INVALID_TIME_NORMALIZATION: 'Start time or end time is missing.',
UNEXPECTED_TIME_CONFIG:
'Unexpected node-level config provided for time-sync plugin.',
Expand Down
1 change: 1 addition & 0 deletions src/lib/initialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const importModuleFrom = async (path: string) => {

return module;
} catch (error) {
logger.error(error);
throw new ModuleInitializationError(INVALID_MODULE_PATH(path));
}
};
Expand Down

0 comments on commit ab95a78

Please sign in to comment.