Package com.atlassian.bamboo.logger
Class DefaultErrorHandler
- java.lang.Object
-
- com.atlassian.bamboo.logger.AbstractErrorUpdateHandler
-
- com.atlassian.bamboo.logger.DefaultErrorHandler
-
- All Implemented Interfaces:
ErrorAccessor,ErrorHandler,ErrorUpdateHandler
public class DefaultErrorHandler extends AbstractErrorUpdateHandler implements ErrorHandler
This class keeps track of Bamboo build errors so they can get reported to the user.
-
-
Field Summary
-
Fields inherited from class com.atlassian.bamboo.logger.AbstractErrorUpdateHandler
agentContext
-
-
Constructor Summary
Constructors Constructor Description DefaultErrorHandler(AgentContext agentContext, com.atlassian.event.api.EventPublisher eventPublisher)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Remove all errors from the handlervoidcreateElasticError(String context, @Nullable Long agentId, @Nullable ThrowableDetails throwableDetails, @Nullable String instanceId)Create an error regarding Elastic Bamboo.voidcreateError(@Nullable String entityKey, Integer resultNumber, Long agentId, String context, ThrowableDetails throwableDetails)voidcreateError(@Nullable String entityKey, Long resultNumber, Long agentId, String context, ThrowableDetails throwableDetails)@NotNull Collection<ErrorDetails>getAllErrors()Get all the errors recorded against all buildsStream<ErrorDetails>getAllErrorsStream()@NotNull Collection<ErrorDetails>getElasticErrors()Get all the errors recorded against elastic bambooErrorDetailsgetErrorDetails(String buildKey, int errorNumber)Obtain the specified error from the handler.@NotNull Collection<ErrorDetails>getErrors(@NotNull Key planKey)Obtain all the errors recorded against a specific plan@NotNull Collection<ErrorDetails>getErrors(@NotNull ResultKey resultKey)Obtain all the errors recorded against a specific result@NotNull Collection<ErrorDetails>getErrorsByAgentId(Long agentId)Obtain all the errors recorded filtered by Agent IdvoidremoveBuildErrors(String buildKey)Remove all the errors for a given buildvoidremoveError(String buildKey, int errorNumber)Remove a specific error from the handler.-
Methods inherited from class com.atlassian.bamboo.logger.AbstractErrorUpdateHandler
addErrorCollection, getCurrentAgentId, recordElasticError, recordError, recordError, recordError, recordError, recordError, recordError, recordError
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.atlassian.bamboo.logger.ErrorUpdateHandler
addErrorCollection, recordElasticError, recordError, recordError, recordError, recordError, recordError, recordError, recordError
-
-
-
-
Constructor Detail
-
DefaultErrorHandler
public DefaultErrorHandler(AgentContext agentContext, com.atlassian.event.api.EventPublisher eventPublisher)
-
-
Method Detail
-
createElasticError
public void createElasticError(String context, @Nullable @Nullable Long agentId, @Nullable @Nullable ThrowableDetails throwableDetails, @Nullable @Nullable String instanceId)
Description copied from interface:ErrorUpdateHandlerCreate an error regarding Elastic Bamboo.- Specified by:
createElasticErrorin interfaceErrorUpdateHandler
-
createError
public void createError(@Nullable @Nullable String entityKey, Integer resultNumber, Long agentId, String context, ThrowableDetails throwableDetails)- Specified by:
createErrorin interfaceErrorUpdateHandler
-
createError
public void createError(@Nullable @Nullable String entityKey, Long resultNumber, Long agentId, String context, ThrowableDetails throwableDetails)- Specified by:
createErrorin interfaceErrorUpdateHandler
-
getErrors
@NotNull public @NotNull Collection<ErrorDetails> getErrors(@NotNull @NotNull ResultKey resultKey)
Description copied from interface:ErrorAccessorObtain all the errors recorded against a specific result- Specified by:
getErrorsin interfaceErrorAccessor- Returns:
- The collection
ErrorDetails
-
getErrors
@NotNull public @NotNull Collection<ErrorDetails> getErrors(@NotNull @NotNull Key planKey)
Description copied from interface:ErrorAccessorObtain all the errors recorded against a specific plan- Specified by:
getErrorsin interfaceErrorAccessor- Returns:
- The collection
ErrorDetails
-
getAllErrors
@NotNull public @NotNull Collection<ErrorDetails> getAllErrors()
Description copied from interface:ErrorAccessorGet all the errors recorded against all builds- Specified by:
getAllErrorsin interfaceErrorAccessor- Returns:
- The collection
ErrorDetails
-
getAllErrorsStream
public Stream<ErrorDetails> getAllErrorsStream()
-
getErrorsByAgentId
@NotNull public @NotNull Collection<ErrorDetails> getErrorsByAgentId(Long agentId)
Description copied from interface:ErrorAccessorObtain all the errors recorded filtered by Agent Id- Specified by:
getErrorsByAgentIdin interfaceErrorAccessor- Returns:
- The collection
ErrorDetails
-
getElasticErrors
@NotNull public @NotNull Collection<ErrorDetails> getElasticErrors()
Description copied from interface:ErrorAccessorGet all the errors recorded against elastic bamboo- Specified by:
getElasticErrorsin interfaceErrorAccessor- Returns:
- The collection
ErrorDetails
-
clear
public void clear()
Description copied from interface:ErrorHandlerRemove all errors from the handler- Specified by:
clearin interfaceErrorHandler
-
removeError
public void removeError(String buildKey, int errorNumber)
Description copied from interface:ErrorHandlerRemove a specific error from the handler.- Specified by:
removeErrorin interfaceErrorHandler- Parameters:
buildKey- The build containing the errorerrorNumber- The errorIndex'th error to be associated with the build
-
getErrorDetails
public ErrorDetails getErrorDetails(String buildKey, int errorNumber)
Description copied from interface:ErrorHandlerObtain the specified error from the handler.- Specified by:
getErrorDetailsin interfaceErrorHandler- Parameters:
buildKey- The build containing the error.errorNumber- The errorIndex'th error to be associated with the build- Returns:
- The error details
-
removeBuildErrors
public void removeBuildErrors(String buildKey)
Description copied from interface:ErrorHandlerRemove all the errors for a given build- Specified by:
removeBuildErrorsin interfaceErrorHandler- Parameters:
buildKey- The key of the build
-
-