Skip to content

fix/idanluf/apps-CLI-error-handeling-fixes#138

Merged
idanluf merged 4 commits into
masterfrom
fix/idanluf/apps-CLI-error-handeling-fixes
Nov 16, 2025
Merged

fix/idanluf/apps-CLI-error-handeling-fixes#138
idanluf merged 4 commits into
masterfrom
fix/idanluf/apps-CLI-error-handeling-fixes

Conversation

@idanluf
Copy link
Copy Markdown
Collaborator

@idanluf idanluf commented Nov 13, 2025

commands/Scheduler/*.ts:
remove excessive try-catch blocks: to improve error handling.

api-service.ts & api-service-test.ts:
Fix the token error handling to prompt the user directly when an incorrect token is supplied
& Added a test that checks it

push-service.ts:
Add file size verification to the push command, ensuring files do not exceed 75 MB.

https://monday.monday.com/boards/3670992828/views/126769350/pulses/18326407407

Added API error messages for invalid tokens & Added new test for it
Added file size validation for uploads.
@idanluf idanluf requested a review from maorb-dev November 13, 2025 11:39
Comment thread src/services/api-service.ts Outdated
Comment on lines +61 to +62
const isEmptyResponse = !errorAxiosResponse?.message && !title;
const isAuthError = statusCode === 406 && isEmptyResponse;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a new function that is called isAuthError and add jsdoc why did this is how it works

Comment thread src/services/push-service.ts Outdated
};

const checkFileSizesInDirectory = (directoryPath: string): void => {
const MAX_FILE_SIZE_MB = 75;
Copy link
Copy Markdown
Collaborator

@gregra81 gregra81 Nov 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move to the beginning of the file or in a consts file


describe('ApiService', () => {
it('should throw HttpError with helpful token message for invalid token', async () => {
const { execute } = await import('services/api-service');
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move the import to the top of the file and change to static import

const fullPath = path.join(dir, item);
const stats = fs.statSync(fullPath);

if (stats.isDirectory()) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a stopping condition to the recursion

@gregra81
Copy link
Copy Markdown
Collaborator

@idanluf bump the version by patch in package.json

package.json: bump the version
api-service.test: fix imports order
push-service: add max_depth to recursion
api-service: create new function of isAuthError
@idanluf idanluf force-pushed the fix/idanluf/apps-CLI-error-handeling-fixes branch from 0a8c518 to aff1f8d Compare November 16, 2025 14:05
Comment thread src/services/push-service.ts Outdated
const checkFileSizesInDirectory = (directoryPath: string): void => {
const checkDirectory = (dir: string, depth = 0) => {
if (depth > MAX_RECURSION_DEPTH) {
return;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead throw a descriptive error for the end user to change the depth of his project to be less than MAX_RECURSION_DEPTH

Copy link
Copy Markdown
Collaborator

@gregra81 gregra81 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work 💪

@idanluf idanluf merged commit 3bedde4 into master Nov 16, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants