Information
We are currently investigating an issue with the editor of some pages. Please save your work and avoid to create new pages until this banner is gone.
...
Error definitions are elements in XML files with the representation for errors and completions. For instance, a simple definition present in the project:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
...
<ErrorCode name="AlreadyInAutomatic"
shortDescription="Already in automatic mode"
description="Trying to set automatic mode, failed. It has already been set"/>
... |
The errors defined in the XML files need to be declared in the IDLs to be used in component comunications:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
...
void setMode(in boolean mode) raises(SYSTEMErr::AlreadyInAutomaticEx);
... |
Throwing exceptions is done in the servant that implements the IDL method that declared the error.
Python
Code Block |
---|
import SYSTEMErrImpl
...
raise SYSTEMErrImpl.AlreadyInAutomaticExImpl().getAlreadyInAutomaticEx()
... |
Java
Code Block |
---|
import alma.SYSTEMErr.wrappers.AcsJAlreadyInAutomaticEx;
...
throw new AcsJAlreadyInAutomaticEx("Some message...").toAlreadyInAutomaticEx();
... |
C++
Code Block |
---|
#include <SYSTEMErr.h>
...
throw SYSTEMErr::AlreadyInAutomaticExImpl(__FILE__, __LINE__, "Some message...").getAlreadyInAutomaticEx();
... |
Handling is done in the component or client that calls a component through its stub.
Python
Code Block |
---|
import SYSTEMErr
...
try:
...
except SYSTEMErr.AlreadyInAutomaticEx as e:
...
... |
Java
Code Block |
---|
import alma.SYSTEMErr.AlreadyInAutomaticEx;
...
try {
...
} catch (AlreadyInAutomaticEx e) {
...
}
... |
C++
Code Block |
---|
#include <SYSTEMErr.h>
...
try {
...
} catch(SYSTEMErr::AlreadyInAutomaticEx &_ex) {
...
}
... |