Loading pom.xml +1 −1 Original line number Diff line number Diff line Loading @@ -12,7 +12,7 @@ <groupId>es.redmic.lib</groupId> <artifactId>exceptions</artifactId> <packaging>jar</packaging> <version>0.6.0</version> <version>0.7.0</version> <name>Exceptions</name> <description>Exceptions utils and management</description> Loading src/main/java/es/redmic/exception/common/ExceptionType.java +4 −0 Original line number Diff line number Diff line Loading @@ -52,7 +52,9 @@ public enum ExceptionType implements ExceptionTypeItfc { ES_BBOX_QUERY_ERROR(Constants.ES_BBOX_QUERY_ERROR), ES_HISTOGRAM_INTERVAL_QUERY_ERROR(Constants.ES_HISTOGRAM_INTERVAL_QUERY_ERROR), ES_TERM_QUERY_ERROR(Constants.ES_TERM_QUERY_ERROR), ES_QUERY_ERROR(Constants.ES_QUERY_ERROR), ES_INSERT_DOCUMENT(Constants.ES_INSERT_DOCUMENT), ES_CREATE_MAPPING_ERROR(Constants.ES_CREATE_MAPPING_ERROR), // DTOs DTO_NOT_VALID(Constants.DTO_NOT_VALID), Loading Loading @@ -185,7 +187,9 @@ public enum ExceptionType implements ExceptionTypeItfc { ES_BBOX_QUERY_ERROR = "ESBboxQueryError", ES_HISTOGRAM_INTERVAL_QUERY_ERROR = "ESHistogramIntervalQueryError", ES_TERM_QUERY_ERROR = "ESTermQueryError", ES_QUERY_ERROR = "ESQueryError", ES_INSERT_DOCUMENT = "ESInsertError", ES_CREATE_MAPPING_ERROR = "ESCreateMappingError", // DTOs DTO_NOT_VALID = "DTONotValidException", Loading src/main/java/es/redmic/exception/elasticsearch/ESCreateMappingException.java 0 → 100644 +16 −0 Original line number Diff line number Diff line package es.redmic.exception.elasticsearch; import java.util.Arrays; import es.redmic.exception.common.ExceptionType; import es.redmic.exception.common.InternalException; public class ESCreateMappingException extends InternalException { private static final long serialVersionUID = -204107526629212762L; public ESCreateMappingException(String index) { super(ExceptionType.ES_CREATE_MAPPING_ERROR); setFieldErrors(Arrays.asList(index)); } } src/main/java/es/redmic/exception/elasticsearch/ESQueryException.java 0 → 100644 +13 −0 Original line number Diff line number Diff line package es.redmic.exception.elasticsearch; import es.redmic.exception.common.BadRequestException; import es.redmic.exception.common.ExceptionType; public class ESQueryException extends BadRequestException { private static final long serialVersionUID = 3658782399097632577L; public ESQueryException() { super(ExceptionType.ES_QUERY_ERROR); } } src/main/java/es/redmic/exception/factory/ExceptionFactory.java +7 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ import es.redmic.exception.data.DeleteItemException; import es.redmic.exception.data.ItemAlreadyExistException; import es.redmic.exception.data.ItemNotFoundException; import es.redmic.exception.elasticsearch.ESInsertException; import es.redmic.exception.elasticsearch.ESUpdateException; public class ExceptionFactory { Loading @@ -34,6 +35,12 @@ public class ExceptionFactory { && (arguments != null && arguments.size() == 4)) return new ESInsertException("a", "b"); if (exceptionType.equals(ExceptionType.ES_UPDATE_DOCUMENT.name()) && (arguments != null)) return new ESUpdateException("a"); if (exceptionType.equals(ExceptionType.INTERNAL_EXCEPTION.name()) && (arguments == null)) return new InternalException(ExceptionType.INTERNAL_EXCEPTION); logger.error("No se ha encontrado una excepción válida para el tipo y argumentos recibidos"); return new InternalException(ExceptionType.INTERNAL_EXCEPTION); Loading Loading
pom.xml +1 −1 Original line number Diff line number Diff line Loading @@ -12,7 +12,7 @@ <groupId>es.redmic.lib</groupId> <artifactId>exceptions</artifactId> <packaging>jar</packaging> <version>0.6.0</version> <version>0.7.0</version> <name>Exceptions</name> <description>Exceptions utils and management</description> Loading
src/main/java/es/redmic/exception/common/ExceptionType.java +4 −0 Original line number Diff line number Diff line Loading @@ -52,7 +52,9 @@ public enum ExceptionType implements ExceptionTypeItfc { ES_BBOX_QUERY_ERROR(Constants.ES_BBOX_QUERY_ERROR), ES_HISTOGRAM_INTERVAL_QUERY_ERROR(Constants.ES_HISTOGRAM_INTERVAL_QUERY_ERROR), ES_TERM_QUERY_ERROR(Constants.ES_TERM_QUERY_ERROR), ES_QUERY_ERROR(Constants.ES_QUERY_ERROR), ES_INSERT_DOCUMENT(Constants.ES_INSERT_DOCUMENT), ES_CREATE_MAPPING_ERROR(Constants.ES_CREATE_MAPPING_ERROR), // DTOs DTO_NOT_VALID(Constants.DTO_NOT_VALID), Loading Loading @@ -185,7 +187,9 @@ public enum ExceptionType implements ExceptionTypeItfc { ES_BBOX_QUERY_ERROR = "ESBboxQueryError", ES_HISTOGRAM_INTERVAL_QUERY_ERROR = "ESHistogramIntervalQueryError", ES_TERM_QUERY_ERROR = "ESTermQueryError", ES_QUERY_ERROR = "ESQueryError", ES_INSERT_DOCUMENT = "ESInsertError", ES_CREATE_MAPPING_ERROR = "ESCreateMappingError", // DTOs DTO_NOT_VALID = "DTONotValidException", Loading
src/main/java/es/redmic/exception/elasticsearch/ESCreateMappingException.java 0 → 100644 +16 −0 Original line number Diff line number Diff line package es.redmic.exception.elasticsearch; import java.util.Arrays; import es.redmic.exception.common.ExceptionType; import es.redmic.exception.common.InternalException; public class ESCreateMappingException extends InternalException { private static final long serialVersionUID = -204107526629212762L; public ESCreateMappingException(String index) { super(ExceptionType.ES_CREATE_MAPPING_ERROR); setFieldErrors(Arrays.asList(index)); } }
src/main/java/es/redmic/exception/elasticsearch/ESQueryException.java 0 → 100644 +13 −0 Original line number Diff line number Diff line package es.redmic.exception.elasticsearch; import es.redmic.exception.common.BadRequestException; import es.redmic.exception.common.ExceptionType; public class ESQueryException extends BadRequestException { private static final long serialVersionUID = 3658782399097632577L; public ESQueryException() { super(ExceptionType.ES_QUERY_ERROR); } }
src/main/java/es/redmic/exception/factory/ExceptionFactory.java +7 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ import es.redmic.exception.data.DeleteItemException; import es.redmic.exception.data.ItemAlreadyExistException; import es.redmic.exception.data.ItemNotFoundException; import es.redmic.exception.elasticsearch.ESInsertException; import es.redmic.exception.elasticsearch.ESUpdateException; public class ExceptionFactory { Loading @@ -34,6 +35,12 @@ public class ExceptionFactory { && (arguments != null && arguments.size() == 4)) return new ESInsertException("a", "b"); if (exceptionType.equals(ExceptionType.ES_UPDATE_DOCUMENT.name()) && (arguments != null)) return new ESUpdateException("a"); if (exceptionType.equals(ExceptionType.INTERNAL_EXCEPTION.name()) && (arguments == null)) return new InternalException(ExceptionType.INTERNAL_EXCEPTION); logger.error("No se ha encontrado una excepción válida para el tipo y argumentos recibidos"); return new InternalException(ExceptionType.INTERNAL_EXCEPTION); Loading