Package org.eclipse.birt.report.model.api

# Class ErrorDetail

java.lang.Object
org.eclipse.birt.report.model.api.ErrorDetail

All Implemented Interfaces:
  `ErrorCodes`

public final class ErrorDetail extends Object implements ErrorCodes
Provides detail information about errors found when opening a design file. Includes the error type, error code, error message and so on.

Errors with types INVALID_XML, SYNTAX_ERROR or SEMANTIC_ERROR, can be translated to an instance of this class. All error type constants are defined in `DesignFileException`.

| Invalid XML File | Syntax Error | Semantic Error
--- | --- | --- | ---
type | INVALID_XML | SYNTAX_ERROR | SEMANTIC_ERROR
error code | N/A | Y | Y
exception name | Y | Y | Y
message | Y | Y | Y
line number | Y | Y | N/A
tag number | Y | Y | N/A
element type | N/A | N/A | Y
element name | N/A | N/A | Y

Note output message in this class are locale independent. ONLY for debugging, not user-visible. Debugging messages are defined to be in English.

See Also:
  - `DesignFileException`

## Field Summary

### Fields inherited from interface org.eclipse.birt.report.model.api.ErrorCodes

`DESIGN_EXCEPTION_UNSUPPORTED_VERSION`

## Constructor Summary

Constructors
Constructor
Description
`ErrorDetail(Exception e)`
Constructs the error detail with a given exception.

## Method Summary

Modifier and Type
Method
Description
`static List<ErrorDetail>`
`convertExceptionList(List<? extends Exception> exceptionList)`
Converts the exception list to the error detail list.
`org.eclipse.birt.report.model.core.DesignElement`
`getElement()`
Returns the element that causes error.
`String`
`getErrorCode()`
Returns the error code of the cause of the exception.
`String`
`getExceptionName()`
Returns the name of exception with package prefix.
`int`
`getLineNo()`
Returns line number in design file, where error is found.
`String`
`getMessage()`
Returns the error message.
`static List<ErrorDetail>`
`getSemanticErrors(List<ErrorDetail> errors, String errorType)`
Returns a list containing the semantic errors with the given error type.
`String`
`getSubEditor()`
Returns the reference to the editor.
`String`
`getTagName()`
Returns the tag name that causes error.
`String`
`getType()`
Returns the error type.
`String`
`getValidationID()`
Returns the validation ID, which identifies one specific validation.
`void`
`setValidationID(String validationID)`
Sets the validation ID, which identifies one specific validation.
`String`
`toString()`
Note output message are locale independent.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### ErrorDetail

public ErrorDetail(Exception e)
Constructs the error detail with a given exception.

Parameters:
  `e` - the exception types that can be translated are `XMLParserException`, `DesignParserException`, `SemanticException` , `SAXException`.

## Method Details

### toString

public String toString()
Note output message are locale independent. ONLY for debugging, not user-visible. Therefore, no NON-NLS required.

Overrides:
  `toString` in class `Object`
See Also:
  - `Object.toString()`

### getElement

public org.eclipse.birt.report.model.core.DesignElement getElement()
Returns the element that causes error.

Returns:
  the element that causes error.

### getErrorCode

public String getErrorCode()
Returns the error code of the cause of the exception. The value is defined in the cause exception class.

Returns:
  error code

### getExceptionName

public String getExceptionName()
Returns the name of exception with package prefix.

Returns:
  name of exception.

### getLineNo

public int getLineNo()
Returns line number in design file, where error is found. Note: For INVALID_XML, the line number is not accurate. Basically, the error can be found after the indicated line a bit.

Returns:
  line number in design file

### getMessage

public String getMessage()
Returns the error message.

Returns:
  the localized error message as a string

### getTagName

public String getTagName()
Returns the tag name that causes error.

Returns:
  the tag name

### getType

public String getType()
Returns the error type. The value is defined in `DesignFileException`.

Returns:
  the error type
See Also:
  - `DesignFileException`

### setValidationID

public void setValidationID(String validationID)
Sets the validation ID, which identifies one specific validation.

Parameters:
  `validationID` - the validation ID

### getValidationID

public String getValidationID()
Returns the validation ID, which identifies one specific validation.

Returns:
  the validator ID

### convertExceptionList

public static List<ErrorDetail> convertExceptionList(List<? extends Exception> exceptionList)
Converts the exception list to the error detail list.

Parameters:
  `exceptionList` - list of `SemanticException`.
Returns:
  the error detail list of `ErrorDetail`

### getSemanticErrors

public static List<ErrorDetail> getSemanticErrors(List<ErrorDetail> errors, String errorType)
Returns a list containing the semantic errors with the given error type.

Parameters:
  `errors` - the list of the error details
  `errorType` - the semantic error type. The possible value is:
  - `DesignFileException.SEMANTIC_ERROR`
  - `DesignFileException.SEMANTIC_WARNING`
  - `DesignFileException.SYNTAX_ERROR`
Returns:
  a list containing specified semantic errors. Each element in the list is `ErrorDetail`.

### getSubEditor

public String getSubEditor()
Returns the reference to the editor.

Returns:
  The reference to the editor.For example graphic editor, xml source editor, script editor and so on.