Commit e996aeb8 authored by Noel Alonso's avatar Noel Alonso
Browse files

Merge branch 'dev' into 'master'

Aumenta versión

See merge request redmic-project/server/library/exceptions!2
parents 12676c9d fd6dc60f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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>

+4 −0
Original line number Diff line number Diff line
@@ -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),
@@ -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",
+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));
	}
}
+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);
	}
}
+7 −0
Original line number Diff line number Diff line
@@ -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 {

@@ -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