DOORS DXL Error Handling

What is DOORS DXL error handling?

DXL (DOORS eXtension Language) is a scripting language used in IBM Rational DOORS, a requirements management tool. As with any programming language, error handling is an important aspect of writing robust and reliable code in DXL.

For run-time error reports of DXL scripts, the function backtrace, or callstack, is reported.

Here is an example code –

void foo()
 string s
 print s

void bar()

The result will be:

-R-E- DXL: unassigned variable (s)
-I- DXL: execution halted

In case of parse time errors, the #include nesting of files is reported, in addition to the file
and line number of the error. For example –

First DXL File –

//file F1.dxl
#include <c:\temp\f2.dxl>

Second DXL File –

//file f2.dxl
while //syntax error

Now, execute the following DXL statement

#include <c:\temp\f1.dxl>

This returns the following error –

-E- DXL: <c:\temp\f2.dxl:2> syntax error
Included from:
-I- DXL: all done with 1 error and 0 warnings

Here are the few functions that are useful for DOORS DXL error handling –

void error (string message)

This function can be used to terminate the dxl code and print out the specific error message in the DXL interaction window.

string lastError()

This function can be used to return the last error as a string. If the noError() function has already been called, the dxl code may not terminate when a error condition is discovered. This function can help in printing the error message.

void noError()

This function switches off the DOORS DXL run-time errors until the lastError is called. When an error condition is discovered, it records the error message instead of failing and halting. This error message then can be checked by lastError() function.

Calling this function resets the error message to null.

Log Errors

Write error messages to a log file or the console so that you can diagnose and fix the problem later. Logging is particularly useful in production environments, where errors may occur when users are not present to diagnose and fix the problem.

Check Return Code

Many DOORS DXL functions return a code indicating whether the function succeeded or failed. Always check the return code and take appropriate action if the function fails. For example:

int rc = doSomething();
if (rc != 0) {
    // handle the error

In this example, the doSomething() function returns an integer value, which is assigned to the variable rc. If the return value is not zero, it indicates that an error occurred. The code then takes appropriate action to handle the error.


In conclusion, error handling is an important aspect of writing robust and reliable DOORS DXL code. By using try-catch blocks, checking return codes, providing meaningful error messages, logging errors, and using assertions, you can improve the quality and reliability of your DXL scripts.

DOORS DXL Error Handling
Scroll to top
error: Content is protected !!