Skip to content

Commit

Permalink
make exceptions work again
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasPetter committed Jan 14, 2015
1 parent 94c8557 commit 62a9031
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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

0 comments on commit 62a9031

Please sign in to comment.