From a174b00fa627b362e57d77676b5ce7b0765f7521 Mon Sep 17 00:00:00 2001 From: Stefan Obermeier Date: Mon, 26 Jun 2017 15:11:59 +0200 Subject: [PATCH] Throw more specific exception if no queryspace was registered. --- .../scray/querying/description/internal/exceptions.scala | 6 +++++- scray-querying/src/main/scala/scray/querying/package.scala | 1 + .../src/main/scala/scray/querying/planning/Planner.scala | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) 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 e841dca91..6268db9ae 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 @@ -43,7 +43,11 @@ class QueryWithoutColumnsException(query: Query) class QueryspaceViolationException(query: Query) 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 NoQueryspaceRegistered (query: Query) + extends ScrayException(ExceptionIDs.noQueryspaceRegistered, query.getQueryID, s"""no registerd queryspace found; + queryspace=${query.getQueryspace}, table=${query.getTableIdentifier} """) with Serializable + class QueryspaceViolationTableUnavailableException(query: Query) extends ScrayException(ExceptionIDs.queryspaceViolationTableUnavailableExceptionID, query.getQueryID, s"""query trys to access table which has no version (yet); queryspace=${query.getQueryspace}, table=${query.getTableIdentifier} """) with Serializable diff --git a/scray-querying/src/main/scala/scray/querying/package.scala b/scray-querying/src/main/scala/scray/querying/package.scala index be4b1fb33..a048fcb52 100644 --- a/scray-querying/src/main/scala/scray/querying/package.scala +++ b/scray-querying/src/main/scala/scray/querying/package.scala @@ -15,6 +15,7 @@ package object querying { val plannerShutdownExceptionID = "SIL-Scray-Querying-013" val indexTypeExceptionID = "SIL-Scray-Querying-014" val queryCostsAreTooHigh = "SIL-Scray-Querying-015" + val noQueryspaceRegistered = "SIL-Scray-Querying-016" // 700+ = caching errors val wrongQueryTypeForCacheID = "SIL-Scray-Querying-700" // 800+ = errors for specific queries diff --git a/scray-querying/src/main/scala/scray/querying/planning/Planner.scala b/scray-querying/src/main/scala/scray/querying/planning/Planner.scala index a9cb4a804..3084ea193 100644 --- a/scray-querying/src/main/scala/scray/querying/planning/Planner.scala +++ b/scray-querying/src/main/scala/scray/querying/planning/Planner.scala @@ -131,7 +131,7 @@ object Planner extends LazyLogging { */ @inline def basicVerifyQuery(query: Query): Int = { // then we can retrieve the latest version of this queryspace - val version = Registry.getLatestVersion(query.getQueryspace).getOrElse({logger.warn("No latest version found");throw new QueryspaceViolationException(query)}) + val version = Registry.getLatestVersion(query.getQueryspace).getOrElse({logger.error("No latest version for queryspace found!");throw new NoQueryspaceRegistered(query)}) // check that the queryspace is there Registry.getQuerySpace(query.getQueryspace, version).orElse({logger.warn("No queryspace found"); throw new QueryspaceViolationException(query)})