## 4.2.15.16.4  Standard Library
The XCO standard library provides lightweight abstractions to simplify everyday programming tasks and defines central abstractions, most notably IF\_XCO\_NEWS and IF\_XCO\_TEXT, that provide a common language to foster synergies between different XCO modules.
## Building blocks
There are several basic building blocks defined within the XCO standard library that are used throughout the modules of the whole XCO library and may even be integrated into custom coding.
## Exception philosophy
Unless a caller can be reasonably expected to recover from an error situation is always handled through NO\_CHECK exceptions that are derived from CX\_XCO\_RUNTIME\_EXCEPTION.
The class CX\_XCO\_RUNTIME\_EXCEPTION is an abstract class that defines aspects that are common to all kinds of unexpected error situations. Most importantly, it provides access to the messages of the exceptional situation via IF\_XCO\_NEWS.
On top of that, every time a CX\_XCO\_RUNTIME\_EXCEPTION is raised the active call stack is captured when the exception object is constructed. By having exception classes inherit from CX\_XCO\_RUNTIME\_EXCEPTION stack traces can also be easily enabled for self-defined exceptions.
When such an exception is logged via the XCO BAL module the stack trace will be included along with the message of the exception (assuming the XCO\_CP\_BAL=&gt;EXCEPTION\_ADDITION-&gt;STACK\_TRACE exception addition has been enabled).
## News
The interface IF\_XCO\_NEWS provides a central abstraction that is applicable to any object that can naturally act as a source of messages. A message is defined as an object of type IF\_XCO\_MESSAGE which in turn is characterized by a SYMSG value.
As the interface IF\_XCO\_NEWS can be flexibly mixed in with existing class hierarchies it provides a common denominator that enables communication between independent modules both within the XCO library as well as between the XCO library and custom coding.
A good example for the synergies created by the IF\_XCO\_NEWS abstraction is the interplay of the XCO BAL module with the XCO ADT standard library functionality which is described below. Even though the XCO ADT functionality has no knowledge and is completely independent of the XCO BAL module writing all the messages contained in a log to the console is as simple as
##  Sample Code
```
out->write( lo_log->messages->all )
```
Notable implementations of IF\_XCO\_NEWS are:
- IF\_XCO\_RAP\_BEHAVIOR\_MESSAGE. Obtainable via XCO\_CP\_RAP=&gt;BEHAVIOR MESSAGE( … ), an IF\_XCO\_RAP\_BEHAVIOR\_MESSAGE encapsulates an IF\_ABAP\_BEHV\_MESSAGE and allows it to be used anywhere where an IF\_XCO\_NEWS object can be used.
## Text
Closely related to the IF\_XCO\_NEWS abstraction is the IF\_XCO\_TEXT interface. The main difference is that it represents an object than can naturally act as a source of strings (as compared to an object that can naturally act as a source of messages as is the case with IF\_XCO\_NEWS).
Like IF\_XCO\_NEWS it provides a common ground for many different XCO modules. It is furthermore the basis of the IF\_XCO\_PRINTABLE interface which allows to define a print version for any object that is used when the object is written to the console via the XCO ADT functionality (see ADT [page 1691]).
## Related Information
ADT [page 1691] JSON [page 1699] Regular Expression [page 1701]