From 62a9031888a180b2192df0cd61d8519612671aa5 Mon Sep 17 00:00:00 2001 From: Andreas Petter Date: Wed, 14 Jan 2015 14:43:09 +0100 Subject: [PATCH] make exceptions work again --- .../common/exceptions/ScrayException.java | 11 +++++---- .../description/internal/exceptions.scala | 24 +++++++++---------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/scray-common/src/main/java/scray/common/exceptions/ScrayException.java b/scray-common/src/main/java/scray/common/exceptions/ScrayException.java index 95654deaf..910483499 100644 --- a/scray-common/src/main/java/scray/common/exceptions/ScrayException.java +++ b/scray-common/src/main/java/scray/common/exceptions/ScrayException.java @@ -23,21 +23,22 @@ * */ public class ScrayException extends Exception implements Serializable { + + private static final long serialVersionUID = 1L; public ScrayException(String id, UUID query, String msg, Throwable cause) { - super(id + ": " + msg + (q != null)?(" for query " + q):"", cause) + super(id + ": " + msg + ((query != null)?(" for query " + query.toString()):""), cause); } public ScrayException(String id, String msg, Throwable cause) { - this(id, null, msg, cause) + this(id, null, msg, cause); } public ScrayException(String id, UUID query, String msg) { - this(id, query, msg, null) + this(id, query, msg, null); } public ScrayException(String id, String msg) { - this(id, null, msg, null) + this(id, null, msg, null); } - } diff --git a/scray-querying/src/main/scala/scray/querying/description/internal/exceptions.scala b/scray-querying/src/main/scala/scray/querying/description/internal/exceptions.scala index dd60f52c8..238ea3794 100644 --- a/scray-querying/src/main/scala/scray/querying/description/internal/exceptions.scala +++ b/scray-querying/src/main/scala/scray/querying/description/internal/exceptions.scala @@ -22,7 +22,7 @@ import scray.common.exceptions.ScrayException import scray.querying.ExceptionIDs class QueryDomainParserException(reason: QueryDomainParserExceptionReasons.Reason, column: Column, query: Query) - extends ScrayException(ExceptionIDs.queryDomainParserExceptionID, Some(query.getQueryID), + extends ScrayException(ExceptionIDs.queryDomainParserExceptionID, query.getQueryID, s"Could not parse query domains for column:${column.columnName}, reason is:$reason") object QueryDomainParserExceptionReasons extends Enumeration with Serializable { @@ -33,43 +33,43 @@ object QueryDomainParserExceptionReasons extends Enumeration with Serializable { UNKNOWN_DOMAIN_CONFLICT = Value // unknown reason } -class QueryDomainRangeException(column: Column, query: DomainQuery) extends ScrayException(ExceptionIDs.queryDomainRangeException, Some(query.getQueryID), +class QueryDomainRangeException(column: Column, query: DomainQuery) extends ScrayException(ExceptionIDs.queryDomainRangeException, query.getQueryID, s"Could not execute time or wildcard-based index on column:${column.columnName}, reason is that the domain with a range has no bounds at all.") with Serializable class QueryWithoutColumnsException(query: Query) - extends ScrayException(ExceptionIDs.queryWithoutColumnsExceptionID, Some(query.getQueryID), "query contains no columns to query") with Serializable + extends ScrayException(ExceptionIDs.queryWithoutColumnsExceptionID, query.getQueryID, "query contains no columns to query") with Serializable class QueryspaceViolationException(query: Query) - extends ScrayException(ExceptionIDs.queryspaceViolationExceptionID, Some(query.getQueryID), s"""query trys to access queryspace or table which has not + extends ScrayException(ExceptionIDs.queryspaceViolationExceptionID, query.getQueryID, s"""query trys to access queryspace or table which has not been registered; queryspace=${query.getQueryspace}, table=${query.getTableIdentifier} """) with Serializable class QueryspaceColumnViolationException(query: Query, column: Column) - extends ScrayException(ExceptionIDs.queryspaceColumnViolationExceptionID, Some(query.getQueryID), s"""query trys to access column ${column.columnName} from + extends ScrayException(ExceptionIDs.queryspaceColumnViolationExceptionID, query.getQueryID, s"""query trys to access column ${column.columnName} from queryspace ${query.getQueryspace} which has not been registered""") with Serializable class KeyBasedQueryException(query: DomainQuery) - extends ScrayException(ExceptionIDs.keyBasedQueryExceptionID, Some(query.getQueryID), s"""query trys to access queryspace + extends ScrayException(ExceptionIDs.keyBasedQueryExceptionID, query.getQueryID, s"""query trys to access queryspace ${query.getQueryspace} which has not been registered""") with Serializable class NonAtomicClauseException(query: Query) - extends ScrayException(ExceptionIDs.nonAtomicClauseExceptionID, Some(query.getQueryID), "To qualify predicates those must be either be atomic clauses or 'And's") + extends ScrayException(ExceptionIDs.nonAtomicClauseExceptionID, query.getQueryID, "To qualify predicates those must be either be atomic clauses or 'And's") with Serializable class NoPlanException(query: Query) - extends ScrayException(ExceptionIDs.noPlanExceptionID, Some(query.getQueryID), "Could not construct a plan from the query") with Serializable + extends ScrayException(ExceptionIDs.noPlanExceptionID, query.getQueryID, "Could not construct a plan from the query") with Serializable class ExecutorShutdownException(query: Query) - extends ScrayException(ExceptionIDs.plannerShutdownExceptionID, Some(query.getQueryID), "Cannot accept queries any more. Engine shut down.") with Serializable + extends ScrayException(ExceptionIDs.plannerShutdownExceptionID, query.getQueryID, "Cannot accept queries any more. Engine shut down.") with Serializable class IndexTypeException(query: Query) - extends ScrayException(ExceptionIDs.indexTypeExceptionID, Some(query.getQueryID), s"""Index type is not defined or not + extends ScrayException(ExceptionIDs.indexTypeExceptionID, query.getQueryID, s"""Index type is not defined or not available in queryspace ${query.getQueryspace}""") with Serializable class WrongQueryTypeForCacheException(query: DomainQuery, sourceDiscriminant: String) - extends ScrayException(ExceptionIDs.wrongQueryTypeForCacheID, Some(query.getQueryID), s"""Different type query was expected for + extends ScrayException(ExceptionIDs.wrongQueryTypeForCacheID, query.getQueryID, s"""Different type query was expected for this cache for source ${sourceDiscriminant} on query ${query.getQueryspace}""") with Serializable class WildcardIndexRangeException(query: DomainQuery, column: Column) - extends ScrayException(ExceptionIDs.queryWildcardRangeException, Some(query.getQueryID), s"""Ranges can only be queried if the number of + extends ScrayException(ExceptionIDs.queryWildcardRangeException, query.getQueryID, s"""Ranges can only be queried if the number of letters stays the same for the length of the prefix for column ${column.columnName} on query ${query.getQueryspace}""") with Serializable