Skip to content

PrimaryClient: Improve error handling / reporting in sendScriptBlocking #512

Description

@urfeex

Feature summary

The new sendScriptBlocking method introduced in #425 currently returns a boolean success value.
Instead, it should inform callers on what went wrong.

In my personal opinion, the right interface for that would be std::expected, but since we don't do c++23 here, yet, throwing exceptions would be the most straightforward way.

Alternatively, a custom return type could be used, e.g.

struct ScriptExecutionResult
{
  bool success;
  // Those booleans could also be encoded into a REASON enum. They aren't necessarily all being checked.
  bool robot_mode_allows_execution;
  bool safety_mode_allows_execution;
  bool start_timeout;
  std::string message;
  std::optional<RuntimeExceptionMessage> runtime_execption;
  std::vector<ErrorCodeMessage> error_codes;
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions