Archived issue #0029024

DRAW - use common approach for reporting error message on wrong command arguments

Open CASCADEOCCT:DRAWnew2 public notes

Search issues

Description

It is a good practice to output clear error message when DRAW command is called with incorrect arguments. This is done in many commands, however not always in the same way. To provide consistent behavior for all commands, it is proposed to:

1. Define common method for reporting this kind of errors, e.g. Draw_Interpretor::ErrorOnWrongArgs(), to be called as follows:

Standard_Integer mycommand (Draw_Interpretor& theDI, Standard_Integer theArgc, const char** theArgv)
{
  if (theArgc < 3)
  {
    return theDI.ErrorOnWrongArgs (theArgv[0]);
  }
  ...
}


2. Use this method in all DRAW commands

The new method should:

- Print (to std::cerr) error message indicating that command is called with wrong number of arguments

- Print help for the current command to let the user know what arguments are expected (this help should be already recorded when command is added by method Add())

- Return 1 (indicating error in Tcl)

Public activity

2 archived notes

Participants are labeled by their role within this record.

01Commenter 1
Method Draw_Interpretor::ErrorOnWrongArgs() is implemented in branch CR29024

02Commenter 3
Branch [archived branch] has been created by Author.

[revision removed]


Detailed log of new commits:

Author: Author
Date: Mon Aug 21 16:48:23 2017 +0300

    0029024: DRAW - use common approach for reporting error message on wrong command arguments
    
    Method Draw_Interpretor::ErrorOnWrongArgs() is added, providing user message for DRAW command called with incorrect arguments.

Related records