Class ActionErrors
- java.lang.Object
-
- jetbrains.buildServer.controllers.ActionErrors
-
public class ActionErrors extends Object
A storage for various errors that can occur during web controllers execution.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ActionErrors.Error
Represents an error
-
Constructor Summary
Constructors Constructor Description ActionErrors()
Constructs new errors storage
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAll(ActionErrors errors)
Adds all of the errors from the specified errors storage to this storagevoid
addError(String id, String message)
Adds an error with specified id and error message to this storage.void
addError(InvalidProperty ip)
Adds an error with specified id and error message to this storage.void
addException(String id, Exception e)
Adds an error with specified id and the exception's message to the storage.void
fillErrors(PropertiesProcessor processor, Map<String,String> properties)
Fills this errors storage from the invalid properties returned byPropertiesProcessor
TODO: move this method out of web openapiActionErrors.Error
findErrorById(String id)
Searches for an error by specified idList<ActionErrors.Error>
getErrors()
Returns list of errors containing in this errors storage.boolean
hasErrors()
Returns true if this storage contains at least one error.boolean
hasNoErrors()
Returns true if this storage does not contain errorsvoid
serialize(org.jdom.Element rootElement)
Serializes errors containing in this storage into the specified XML document.String
toString()
-
-
-
Method Detail
-
addError
public void addError(@NotNull String id, @Nullable String message)
Adds an error with specified id and error message to this storage.- Parameters:
id
- id of the errormessage
- error message
-
addException
public void addException(@NotNull String id, @NotNull Exception e)
Adds an error with specified id and the exception's message to the storage. If exception's message is null, exception's class is used as message- Parameters:
id
- id of the errore
- exception to take message from- Since:
- 10.0
-
addError
public void addError(@NotNull InvalidProperty ip)
Adds an error with specified id and error message to this storage.- Since:
- 8.0
-
addAll
public void addAll(@NotNull ActionErrors errors)
Adds all of the errors from the specified errors storage to this storage- Parameters:
errors
- errors storage
-
getErrors
@NotNull public List<ActionErrors.Error> getErrors()
Returns list of errors containing in this errors storage.- Returns:
- list of errors
-
findErrorById
@Nullable public ActionErrors.Error findErrorById(@NotNull String id)
Searches for an error by specified id- Parameters:
id
- id of the error- Returns:
- an error or null
-
hasErrors
public boolean hasErrors()
Returns true if this storage contains at least one error.- Returns:
- true if this storage contains at least one error.
-
hasNoErrors
public boolean hasNoErrors()
Returns true if this storage does not contain errors- Returns:
- true if this storage does not contain errors
-
serialize
public void serialize(@NotNull org.jdom.Element rootElement)
Serializes errors containing in this storage into the specified XML document. Errors document structure:
<errors> <error id="{error id}">{error message}</error> </errors>
- Parameters:
rootElement
- element where the errors should be attached See javascript: BS.Util.xmlErrors
-
fillErrors
public void fillErrors(@Nullable PropertiesProcessor processor, @NotNull Map<String,String> properties)
Fills this errors storage from the invalid properties returned byPropertiesProcessor
TODO: move this method out of web openapi- Parameters:
processor
- properties processorproperties
- properties to check
-
-