镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Failed to add task but still reported success #22

Open

Description

@beauraines

I was adding several tasks using the rtm a interactive mode. While I was entering them, my internet went out. Then when finishing with a blank line, it cycled through the tasks, reported a failure and then ended with the success message.

New Task: Install new Comcast modem #personal !1 ^today @home =15 minutes
New Task: Install new Nest floodlight #Personal !1 ~tomorrow ^Saturday =1 hour @home
New Task:
✖ Could not add new Task #1 (Network Error: Could not make request to RTM API Server)
✖ Could not add new Task #2 (Network Error: Could not make request to RTM API Server)
✔ Task(s) Added

I was expecting that the final message would have reported an error.

I've not attempted to troubleshoot this yet.

Activity

  1. progers-de commented on Aug 5, 2024

    @progers-de

    Just hit this same problem this week

  2. beauraines commented on Aug 9, 2024

    @beauraines
    ContributorAuthor

    I may have some time this weekend to troubleshoot this.

  3. progers-de commented on Aug 9, 2024

    @progers-de

    FWIW, I've solved the underlying problem for myself by using the npm version instead of the .exe, but yeah, worth seeing why it says "Task(s) added" when no tasks were added

  4. beauraines commented on Aug 18, 2024

    @beauraines
    ContributorAuthor

    This is where the problem is coming from

    https://github.com/beauraines/rtm-cli/blob/870a8a7408e25f71830e3eae123c7a00eaf84034/src/cmd/add.js#L42-L71

    /**
     * Process the request
     * @private
     */
    function _process(task, count=1, max=1) {
      log.spinner.start("Adding New Task(s)...");
      config.user(function(user) {
        task = _parseTask(task);
    
        // Add Task
        user.tasks.add(task, function(err) {
          if ( err ) {
            log.spinner.error("Could not add new Task #" + count + " (" + err.msg + ")");
          }
          _processFinished(count, max);
        });
      });
    }
    
    /**
     * Request Callback
     * @private
     */
    function _processFinished(count, max) {
      log.spinner.start("Adding Task [" + count + "/" + max + "]...");
      if ( count === max ) {
        log.spinner.success("Task(s) Added");
        return finish();
      }
    }

    If there is an error, it displays that there was an error, but once all the tasks have been processed, it still goes on to _processFinished It seems that _processFinished should take the err as an argument and then display log.spinner.error() with some error message.

    However, this pattern repeats itself through each of the commands...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions