Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove command error handling #195

Closed
beauraines opened this issue Sep 20, 2024 · 0 comments · Fixed by #196
Closed

remove command error handling #195

beauraines opened this issue Sep 20, 2024 · 0 comments · Fixed by #196
Labels
enhancement New feature or request

Comments

@beauraines
Copy link
Owner

The rm command does't fail nicely if the time entry isn't found

$ toggl rm 3614353629
toggl rm <id>

Remove a time entry by id

Options:
  --version  Show version number                                       [boolean]
  --help     Show help                                                 [boolean]

Error: Toggl API responded with status code 404. Response: "Time entry not found"
    at TogglClient.request (file:///Users/beauraines/.nvm/versions/node/v20.14.0/lib/node_modules/@beauraines/toggl-cli/node_modules/toggl-client/lib/client.js:90:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async TogglClient.delete (file:///Users/beauraines/.nvm/versions/node/v20.14.0/lib/node_modules/@beauraines/toggl-cli/node_modules/toggl-client/lib/client.js:79:12)
    at async TimeEntries.delete (file:///Users/beauraines/.nvm/versions/node/v20.14.0/lib/node_modules/@beauraines/toggl-cli/node_modules/toggl-client/lib/time-entries.js:129:5)
    at async Object.handler (file:///Users/beauraines/.nvm/versions/node/v20.14.0/lib/node_modules/@beauraines/toggl-cli/cmds/removeTimeEntry.mjs:10:19)

Add some exception handling or status catching and a nice error message

@beauraines beauraines added the enhancement New feature or request label Sep 20, 2024
beauraines added a commit that referenced this issue Sep 23, 2024
Adds a try-catch when deleting a time entry so that the error output is "nice"

Fixes #195
@beauraines beauraines linked a pull request Sep 23, 2024 that will close this issue
beauraines added a commit that referenced this issue Sep 23, 2024
Adds a try-catch when deleting a time entry so that the error output is "nice"

Fixes #195
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant