8Compilation Error Messages

Compilation Error Messages

This chapter describes error messages that Siebel eScript creates when Siebel Tools compiles ST eScript code. It includes the following topics:

Formats That This chapter Uses

This chapter uses the following formats:

  • The error prefix is the text that displays for all errors in a group of errors. For example,

    Syntax error at Line line# position character#:

  • The message is the unique part of an error message that applies only to a single error. The message can include text appended after an error prefix, or it can include the entire error message.

Format Error Messages

The following table describes error messages that can result from incorrect script format. A format error message starts with the following error prefix: Syntax error at line line# position character#.

Message Example Cause

Expected ':'

Example 1
function main ()
{
 var a = false;
 var b = a ? 1, 2; 
 //expect : after 1
}
Example 2
function main ()
{
 var a = {prop1:1, prop2}; 
 //expect : after prop2
}
Example 3
function main ()
{
 var a = 1;
 var b;
 switch (a)
 {
  case 1  
  //expect : after 1
   b =a;
  default  
  //expect : after default
   b = 0;
 }
}

A colon (:) character is required in the context but you did not provide one. To correct the error, you do the following:

  • In an expression using the conditional operator, make sure you include a colon between the second and third operands.

  • In a Switch statement, make sure you include a colon after the value in the Case statement. For example, see example 3.

Expected ';'

function main ()
{
 for (i=1; i<10 i++) 
 //miss ; after i<10
 {
 ...
 }
}

A semi-colon (;) character is required in the context but you did not provide one.

A semi-colon is used to end a statement. Make sure you do the following:

  • End each statement with a semi-colon.

  • Include a semi-colon in the For Loop statement.

Expected '('

function main <> 
//expect ( after main
{
 ...
}

The open parenthesis ( ( ) and the close parenthesis ( ) ) do not pair up.

Expected ')'.

Not applicable

The open parenthesis ( ( ) and the close parenthesis ( ) ) do not pair up.

Expected ']'.

function main ()
{
 var a = new Array (10);
 a[10 = 1;
 //expect ] after a[10 = 1
}

The open bracket ( [ ) and the close bracket ( ] ) do not pair up.

Expected '{'.

function main ()
var a = new Array (1); 
//expect { before var

The open brace ( { ) and the close brace ( } ) do not pair up.

Expected '}'.

Not applicable

The open brace ( { ) and the close curly brace ( } ) do not pair up.

Expected identifier.

function () 
// expect an identifier after
// function */
{
 ...
}
function main ()
{
 var; 
//expect an identifier after var
}

A name is required in the context but you did not provide one. The name can include one of the following items:

  • Variable

  • Property
  • Array
  • Function name

Invalid token.

function main ()
{
 var a = "\u000G"; 
 // '\u000G' is an invalid
 // unicode character combination 
}
function main ()
{
 var a = "\u0G"; 
 // '\u0G' is an invalid hex
 // character combination 
}

An invalid Unicode character combination or an invalid hex character combination exists.

Expected while.

function main ()
{
 do 
 {
  ...
 } 
 //expect while on this line
}

The Do While statement is not complete. A while method is required to complete the statement but you did not provide one.

Throw must be followed by an expression on the same line.

try
{
var a = 
TheApplication().GetService(“Incorrec
t name”);
}
catch( e )
{
   throw ;
//The Throw statement expects an 
expression which is not supplied 

//It must be: throw e;

}

The Throw statement must be followed by a name that identifies an exception on the same line, but you did not provide an expression of this type.

Invalid continue statement.

function main ()
{
 continue; 
 // continue is not in a loop
}

The Continue statement is not in the body of one of the following items:

  • Do while

  • While
  • For
  • For in

Invalid Break statement.

function BreakError()
{
 break;
// break is not in a valid 
// loop
}

The Break statement is not in the body of one of the following items:

  • Do while

  • While
  • For
  • For in

Invalid return statement. Return statement cannot be used outside the function body.

function fn ()
{
 ….
}
return; 
//Return is outside the function
//body.

A Return statement exists outside the body of a function but it must exist in the body of a function.

Invalid left-hand side value.

function main ()
{
 new Object () = 1; 
 // new Object () is not a valid
 // left value
}

The preceding value in an assignment operation must be compatible with the value assigned.

In the example, the New Object statement is an invalid left-hand value for the equal (=) assignment operator. The valid preceding value must contain a variable.

Invalid regular expression.

var oRegExp:RegExp;
oRegExp = /[a-c*/;
// The regular expression is 
// missing the closing ]. It 
// must be [a-c]*.

The regular expression is invalid. For example, the closing bracket ( ] ) is missing.

Semantic Error Messages

The following table describes error messages that can result from semantic errors when Siebel Tools compiles ST eScript code. A semantic error message starts with the following error prefix: Semantic Error around line line#. For more information, see Semantic Warnings.

Message Examples Cause

Argument argument_label either type does not correct or is not defined.

function main ()
{
fn (new Date(), new Date()); 
// type of the second parameter
// mismatches with function
// definition and cannot be
// implicitly converted to
// 'Number' type
}

function fn (arg1: chars, arg2: 
Number)
{
 TheApplication().RaiseErrorText 
 ("fn");
}

main ();

The argument passed to the function is not of the data type specified in the function definition, or is not defined in the function definition.

In the example, the arg2 parameter must be of type Number, as specified in the function definition, but the function passes the parameter, which is in the following string format:

new date

No such predefined property property_label in class object_type.

function main ()
{
 delete "123".prop1; 
 // prop1 is not a property of
 // String object. Also, because
 // the String object is
 // constructed here by implicitly
 // converting "123", prop1
 // cannot be created dynamically. 
}

The property is not defined in the class object.

In this example, you can specify only string object properties. The following property is not a property of the string object:

Prop1

[] operator can only apply to Object, Buffer or Array class.

Not applicable

The script is trying to use the [] operator for a type other than an object, buffer, or array.

Type mismatch: L: left_type; R: right_type.

Example 1
function TypeMismatch()
{
 var BC:BusComp;
 var MyDate:Date = new Date();
 BC =MyDate; 
// MyDate is not the same data type 
// as strongly typed variable BC
}
Example 1

function fn () { var a: String; a = new Date (); //Type mismatch: strongly typed //String is assigned a Date. }

A value that belongs to one data type is assigned to a strongly typed variable of another data type. For more information, see Using Strongly Typed and Typeless Variables.

Return type is wrong. Defined return type is return_type.

function fn (): Array
{
 return new Date ();
}

fn ();

The actual return type is different from the defined return type. Siebel CRM cannot implicitly convert the actual return type to the defined type.

No such label label defined.

switch( switch_variable )
{
   case value1:
      statement_block
      break labl;
 // where labl is not a valid label
   .
   .
   .
   [default:
      statement_block;]
}

The label referenced in a Break statement or a Goto statement is defined. You must make sure the label name is correct and that the label is defined in the code.

In the example, if the Break statement is to resume at the labl location, then you must define the labl label.

Continue out of loop.

function ContinueOut()
{
 var i =0
 while (i<3)
 {
  i++;
  continue Mylabel; 
  // Mylabel label is defined 
  //outside of the while loop.
 }
 Mylabel:
 var a=1;
}

A continue command attempts to branch to a label that is not in a loop.

Label redefined.

function LabelError()
{
 Outer:
  for (var i = 0; i < 5; i++)
  {
   var j = 0;
   Inner:
    while (j!=5)
    {
     j++;
     continue Inner;
     Inner: //Label Inner is 
            //redefined.
      var b=1;
    }
  }
}

A label already exists that possesses the same name.

function function_label is double defined.

function fn ()
{
 TheApplication().RaiseErrorText 
 ("fn");
}
function fn ()
// second declaration of function
// fn is not allowed
{
 TheApplication().RaiseErrorText 
 ("fn again");
}

A function already exists that possesses the same name.

In the example, you must define the function with a name other than the following name:

fn

Calling function function_label with insufficient number of arguments.

function main ()
{
 fn (); 
 // does not provide enough 
 //parameters
}
function fn (arg1: chars, arg2: 
chars)
{
 ...
}

You did not provide all of the arguments that the function requires.

The number of arguments you include must equal the number specified in the function definition.

In the example, the following function requires two character arguments:

fn

Cannot access property property_name on native type.

function main ()
{
 var a:chars = "123";
 a.m_prop = "123";
 // chars is a primitive, so it
 // has no properties
}
main ();

You cannot write code that assigns a property to a variable that is of a primitive data type, such as char, float, or bool.

In the example, because chars is a primitive data type, you cannot assign it to the following property:

a.m_prop

Object_name is an invalid object type.

function main ()
{
 var a: Obj1 = "123";
 // where Obj1 is an invalid object
 // type

}
main ();

If you use Siebel eScript that is strongly typed, then you must specify a valid data type in the declaration of the variable.

In the example, the following variable is not a defined object type

obj1

For more information, see Using Strongly Typed and Typeless Variables.

Indiscriminate usage of goto.

function main ()
{
 var obj = new Object();
 with (obj)
 {
  labl:
  TheApplication().RaiseErrorText 
  ("in with");
 }
goto labl;
}
main ();

This script uses a Goto statement to attempt a branch to a With statement block from outside of the With statement block.

Semantic Warnings

A semantic warning notifies you that a script will run but it might produce unexpected results or it might not be efficient. A semantic warning does not display during compilation. To view them in Siebel Tools, you choose Debug, and then Check Syntax.

The following table describes semantic warnings in eScript when Siebel Tools compiles ST eScript code. Semantic warnings start with the following prefix: Semantic Warning around line line#. For more information, see Semantic Error Messages.

Message Example Cause

Undefined identifier identifier. Global object will be used to locate the identifier.

function main ()
{
 obj = new Object();
 // obj is created without being 
 // declared with var.
}
main ();

An undeclared variable created in a function is not locally defined. Instead, it is created as a property of the Global object.

Variable variable might not be initialized.

function main ()
{
 var a;
 TheApplication().RaiseErrorText 
 (a);
}
main ();

The variable declared is not explicitly assigned a value. It is recommended that you initialize a variable to a default value when you declare it. For example:

var a="";

In the example, you must assign the following variable a value so Siebel CRM can display it in the RaiseErrorText function:

a

Label 'label' is unused and can be removed.

function main ()
{
 var a = 1;
 labl:
 // labl is unused
 TheApplication().RaiseErrorText 
 (a);
}
main ();

A label is defined in the function but none of the following statements use it. In this situation, you can remove this label:

  • Continue

  • Break

  • Goto

Calling function function_label with insufficient number of arguments.

function main ()
{
// It is a warning condition
// instead of an error if the
// missing argument is not
// strongly typed.*/
 var c = fn ();
}

function fn (a, b)
{
 return a+b;
}
main ();

You did not provide all of the arguments that the function requires.

The number of arguments you provide must equal the number of arguments specified in the function definition.

Type conversion from data_type1 to data_type2 cannot succeed.

function main ()
{
var n: float = "123";
}

When the data type of a variable does not match the value assigned to the variable, the ST eScript engine attempts to convert the data type. This conversion process might not be successful.

In the example, the following string value is assigned to a variable that is of a float data type:

123

The ST eScript engine attempts to convert this string to a float data type.

No such method method_name.

function main ()
{
fn ();
}
main ();

The specified method is not defined or the method name is incorrect.

In the example, you must define fn.

Variable variable is double declared.

Example 1
function fn ()
{
 for (var n = 0 ; n < 3 ; n++)
 {
  ...;
 }
 for (var n = 0 ; n < 3 ; n++)
 // n is double declared in  // 
the scope of fn.
 {
  ...;
}
fn ();
Example 1
function main ()
{
 var string1 = "a string";
 var string1 = “another string”;
 // string1 must not be 
redeclared.
}
main ();

A local variable is declared more than once.

To avoid this warning for the common case in Example 1, you can do the following:

  • Declare the counter variable outside of the for definition.

  • Use the counter variable without var in the for definition.

For example:

function fn ()
{
var n;
for (n = 0 ; n < 3 ; n++)
{
...
}
for (n = 0 ; n < 3 ; n++)
{
...
.

In Example 2, the multiple declarations result in Siebel eScript assigning each declaration that occurs after the first declaration as a simple assignment but with the unnecessary overhead of declaring a variable. Instead, you can use a simple assignment after the first declaration. For example:

string1 = “another 
string”

Preprocessing Error Messages

The following table describes the preprocessing error message created when Siebel Tools compiles ST eScript code. A preprocessing error message indicates a compatibility issue when Oracle’s Siebel Tools compiles ST eScript code. A preprocessing error message starts with the following prefix: PreProcess Error.

Message Example Cause

Cannot open include file file_path.

#include "mystuff.js" 
//where mystuff.js does not 
exist

The path to the file in an Include statement is not valid.

The #include directive instructs the preprocessor to treat the contents of a specified file as if these contents exist in the source program at the same location where the directive occurs. You can organize constants and other definitions in include files, and then use #include directives to add these definitions to any source file.