Skip to content

Commit

Permalink
Throw more specific exception if no queryspace was registered.
Browse files Browse the repository at this point in the history
  • Loading branch information
obermeier committed Jun 26, 2017
1 parent e8721a4 commit a174b00
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions scray-querying/src/main/scala/scray/querying/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)})
Expand Down

0 comments on commit a174b00

Please sign in to comment.