[CORDA-1822]: Improved error message when too many results are asked with default pagination. (#3776)

This commit is contained in:
Michele Sollecito 2018-08-13 16:50:29 +01:00 committed by GitHub
parent 7607244557
commit 3b63723934
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -454,9 +454,9 @@ class NodeVaultService(
val results = query.resultList
// final pagination check (fail-fast on too many results when no pagination specified)
if (!skipPagingChecks && paging.isDefault && results.size > DEFAULT_PAGE_SIZE)
throw VaultQueryException("Please specify a `PageSpecification` as there are more results [${results.size}] than the default page size [$DEFAULT_PAGE_SIZE]")
if (!skipPagingChecks && paging.isDefault && results.size > DEFAULT_PAGE_SIZE) {
throw VaultQueryException("There are ${results.size} results, which exceeds the limit of $DEFAULT_PAGE_SIZE for queries that do not specify paging. In order to retrieve these results, provide a `PageSpecification(pageNumber, pageSize)` to the method invoked.")
}
val statesAndRefs: MutableList<StateAndRef<T>> = mutableListOf()
val statesMeta: MutableList<Vault.StateMetadata> = mutableListOf()
val otherResults: MutableList<Any> = mutableListOf()

View File

@ -1176,7 +1176,7 @@ abstract class VaultQueryTestsBase : VaultQueryParties {
@Test
fun `pagination not specified but more than default results available`() {
expectedEx.expect(VaultQueryException::class.java)
expectedEx.expectMessage("Please specify a `PageSpecification`")
expectedEx.expectMessage("provide a `PageSpecification(pageNumber, pageSize)`")
database.transaction {
vaultFiller.fillWithSomeTestCash(201.DOLLARS, notaryServices, 201, DUMMY_CASH_ISSUER)

View File

@ -71,7 +71,7 @@ fun main(args: Array<String>) {
log.error(e.message)
exitProcess(1)
} catch (e: Exception) {
log.error("Exception during node startup", e)
log.error("Exception during webserver startup", e)
exitProcess(1)
}
}