From 1f40b197e06c3d2719ad86b6c3a83bce2cad4613 Mon Sep 17 00:00:00 2001 From: Chris Morley Date: Mon, 23 May 2022 16:05:36 -0400 Subject: [PATCH 1/5] hello --- hello | 0 kevin_errors.txt | 19 +++++++++++++++++++ notes.txt | 1 + run.sh | 2 ++ run_helper.sh | 3 +++ 5 files changed, 25 insertions(+) create mode 100644 hello create mode 100644 kevin_errors.txt create mode 100644 notes.txt create mode 100755 run.sh create mode 100644 run_helper.sh diff --git a/hello b/hello new file mode 100644 index 00000000..e69de29b diff --git a/kevin_errors.txt b/kevin_errors.txt new file mode 100644 index 00000000..68f7b756 --- /dev/null +++ b/kevin_errors.txt @@ -0,0 +1,19 @@ +play.api.UnexpectedException: Unexpected exception[JsResultException: JsResultException(errors:List(((0),List(JsonValidationError(List(error.expected.jsstring),WrappedArray()))), ((1),List(JsonValidationError(List(error.expected.jsstring),WrappedArray())))))] +play.api.UnexpectedException: Unexpected exception[JsResultException: JsResultException(errors:List(((0),List(JsonValidationError(List(error.expected.jsstring),WrappedArray()))), ((1),List(JsonValidationError(List(error.expected.jsstring),WrappedArray())))))] +play.api.UnexpectedException: Unexpected exception[JsResultException: JsResultException(errors:List(((0),List(JsonValidationError(List(error.expected.jsstring),WrappedArray()))), ((1),List(JsonValidationError(List(error.expected.jsstring),WrappedArray())))))] +play.api.UnexpectedException: Unexpected exception[JsResultException: JsResultException(errors:List(((0),List(JsonValidationError(List(error.expected.jsstring),WrappedArray()))), ((1),List(JsonValidationError(List(error.expected.jsstring),WrappedArray())))))] +play.api.UnexpectedException: Unexpected exception[JsResultException: JsResultException(errors:List(((0),List(JsonValidationError(List(error.expected.jsstring),WrappedArray()))), ((1),List(JsonValidationError(List(error.expected.jsstring),WrappedArray())))))] +play.api.UnexpectedException: Unexpected exception[JsResultException: JsResultException(errors:List(((0),List(JsonValidationError(List(error.expected.jsstring),WrappedArray()))), ((1),List(JsonValidationError(List(error.expected.jsstring),WrappedArray())))))] +play.api.UnexpectedException: Unexpected exception[JsResultException: JsResultException(errors:List(((0),List(JsonValidationError(List(error.expected.jsstring),WrappedArray()))), ((1),List(JsonValidationError(List(error.expected.jsstring),WrappedArray())))))] +play.api.UnexpectedException: Unexpected exception[JsResultException: JsResultException(errors:List(((0),List(JsonValidationError(List(error.expected.jsstring),WrappedArray()))), ((1),List(JsonValidationError(List(error.expected.jsstring),WrappedArray())))))] +play.api.UnexpectedException: Unexpected exception[JsResultException: JsResultException(errors:List(((0),List(JsonValidationError(List(error.expected.jsstring),WrappedArray()))), ((1),List(JsonValidationError(List(error.expected.jsstring),WrappedArray())))))] +play.api.UnexpectedException: Unexpected exception[JsResultException: JsResultException(errors:List(((0),List(JsonValidationError(List(error.expected.jsstring),WrappedArray()))), ((1),List(JsonValidationError(List(error.expected.jsstring),WrappedArray())))))] +play.api.UnexpectedException: Unexpected exception[JsResultException: JsResultException(errors:List(((0),List(JsonValidationError(List(error.expected.jsstring),WrappedArray()))), ((1),List(JsonValidationError(List(error.expected.jsstring),WrappedArray())))))] +play.api.UnexpectedException: Unexpected exception[JsResultException: JsResultException(errors:List((/upDownRules,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/deleteRules,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/filterRules,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/synonymRules,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/redirectRules,List(JsonValidationError(List(error.path.missing),WrappedArray())))))] +play.api.UnexpectedException: Unexpected exception[JsResultException: JsResultException(errors:List((/upDownRules,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/deleteRules,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/filterRules,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/synonymRules,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/redirectRules,List(JsonValidationError(List(error.path.missing),WrappedArray())))))] +play.api.UnexpectedException: Unexpected exception[BatchUpdateException: Duplicate entry '5f4fa25d-21cd-4348-b6b0-908cafdf29e9' for key 'PRIMARY'] +play.api.UnexpectedException: Unexpected exception[BatchUpdateException: Duplicate entry 'e78aa12d-5941-4370-8489-3e15b94e02df' for key 'PRIMARY'] +play.api.UnexpectedException: Unexpected exception[SQLIntegrityConstraintViolationException: Duplicate entry 'ecommerce' for key 'solr_index_field_name'] +play.api.UnexpectedException: Unexpected exception[SQLIntegrityConstraintViolationException: Duplicate entry 'ecommerce' for key 'solr_index_field_name'] +play.api.UnexpectedException: Unexpected exception[SQLIntegrityConstraintViolationException: Duplicate entry 'ecommerce' for key 'solr_index_field_name'] +play.api.UnexpectedException: Unexpected exception[NoSuchElementException: head of empty list] \ No newline at end of file diff --git a/notes.txt b/notes.txt new file mode 100644 index 00000000..9420bc23 --- /dev/null +++ b/notes.txt @@ -0,0 +1 @@ +make docker-build-only \ No newline at end of file diff --git a/run.sh b/run.sh new file mode 100755 index 00000000..93831f91 --- /dev/null +++ b/run.sh @@ -0,0 +1,2 @@ +#!/bin/bash +source run_helper.sh \ No newline at end of file diff --git a/run_helper.sh b/run_helper.sh new file mode 100644 index 00000000..9d32e3ab --- /dev/null +++ b/run_helper.sh @@ -0,0 +1,3 @@ +#!/bin/bash +source ~/.zshrc +sbt run -Dconfig.file=./smui-dev.conf 9000 \ No newline at end of file From 73ffe512222f5565881482e2be218c1e1ce40c63 Mon Sep 17 00:00:00 2001 From: Chris Morley Date: Tue, 24 May 2022 13:46:47 -0400 Subject: [PATCH 2/5] rm test files; fix error messages on rules collection creation --- .../rules-collection-create.component.ts | 23 ++++++++++++++++--- hello | 0 kevin_errors.txt | 19 --------------- notes.txt | 1 - run.sh | 2 -- run_helper.sh | 3 --- 6 files changed, 20 insertions(+), 28 deletions(-) delete mode 100644 hello delete mode 100644 kevin_errors.txt delete mode 100644 notes.txt delete mode 100755 run.sh delete mode 100644 run_helper.sh diff --git a/frontend/src/app/components/admin/rules-collection-create/rules-collection-create.component.ts b/frontend/src/app/components/admin/rules-collection-create/rules-collection-create.component.ts index ea64f919..a678e507 100644 --- a/frontend/src/app/components/admin/rules-collection-create/rules-collection-create.component.ts +++ b/frontend/src/app/components/admin/rules-collection-create/rules-collection-create.component.ts @@ -64,9 +64,26 @@ export class RulesCollectionCreateComponent implements OnInit, OnChanges { .then(() => this.showSuccessMsg.emit("Created new Rules Collection " + this.description)) .then(() => this.solrService.emitRulesCollectionChangeEvent("")) .then(() => this.clearForm()) - .catch(error => this.showErrorMsg.emit(error)); + .catch(error => { + console.log(error); + var showAlreadyExists = false; + var errorMsg = 'Unknown Error' + if ('status' in error) { + errorMsg += ": " + error.status; + if (error.status == 500) { + showAlreadyExists = true; + } + } + if ('statusText' in error) { + errorMsg += " " + error.statusText; + } + if (showAlreadyExists) { + errorMsg += " (Rules collection for that search engine collection already exists?)" + } + this.showErrorMsg.emit(errorMsg); + }); + } else { + this.showErrorMsg.emit("Fill in both name fields."); } } - - } diff --git a/hello b/hello deleted file mode 100644 index e69de29b..00000000 diff --git a/kevin_errors.txt b/kevin_errors.txt deleted file mode 100644 index 68f7b756..00000000 --- a/kevin_errors.txt +++ /dev/null @@ -1,19 +0,0 @@ -play.api.UnexpectedException: Unexpected exception[JsResultException: JsResultException(errors:List(((0),List(JsonValidationError(List(error.expected.jsstring),WrappedArray()))), ((1),List(JsonValidationError(List(error.expected.jsstring),WrappedArray())))))] -play.api.UnexpectedException: Unexpected exception[JsResultException: JsResultException(errors:List(((0),List(JsonValidationError(List(error.expected.jsstring),WrappedArray()))), ((1),List(JsonValidationError(List(error.expected.jsstring),WrappedArray())))))] -play.api.UnexpectedException: Unexpected exception[JsResultException: JsResultException(errors:List(((0),List(JsonValidationError(List(error.expected.jsstring),WrappedArray()))), ((1),List(JsonValidationError(List(error.expected.jsstring),WrappedArray())))))] -play.api.UnexpectedException: Unexpected exception[JsResultException: JsResultException(errors:List(((0),List(JsonValidationError(List(error.expected.jsstring),WrappedArray()))), ((1),List(JsonValidationError(List(error.expected.jsstring),WrappedArray())))))] -play.api.UnexpectedException: Unexpected exception[JsResultException: JsResultException(errors:List(((0),List(JsonValidationError(List(error.expected.jsstring),WrappedArray()))), ((1),List(JsonValidationError(List(error.expected.jsstring),WrappedArray())))))] -play.api.UnexpectedException: Unexpected exception[JsResultException: JsResultException(errors:List(((0),List(JsonValidationError(List(error.expected.jsstring),WrappedArray()))), ((1),List(JsonValidationError(List(error.expected.jsstring),WrappedArray())))))] -play.api.UnexpectedException: Unexpected exception[JsResultException: JsResultException(errors:List(((0),List(JsonValidationError(List(error.expected.jsstring),WrappedArray()))), ((1),List(JsonValidationError(List(error.expected.jsstring),WrappedArray())))))] -play.api.UnexpectedException: Unexpected exception[JsResultException: JsResultException(errors:List(((0),List(JsonValidationError(List(error.expected.jsstring),WrappedArray()))), ((1),List(JsonValidationError(List(error.expected.jsstring),WrappedArray())))))] -play.api.UnexpectedException: Unexpected exception[JsResultException: JsResultException(errors:List(((0),List(JsonValidationError(List(error.expected.jsstring),WrappedArray()))), ((1),List(JsonValidationError(List(error.expected.jsstring),WrappedArray())))))] -play.api.UnexpectedException: Unexpected exception[JsResultException: JsResultException(errors:List(((0),List(JsonValidationError(List(error.expected.jsstring),WrappedArray()))), ((1),List(JsonValidationError(List(error.expected.jsstring),WrappedArray())))))] -play.api.UnexpectedException: Unexpected exception[JsResultException: JsResultException(errors:List(((0),List(JsonValidationError(List(error.expected.jsstring),WrappedArray()))), ((1),List(JsonValidationError(List(error.expected.jsstring),WrappedArray())))))] -play.api.UnexpectedException: Unexpected exception[JsResultException: JsResultException(errors:List((/upDownRules,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/deleteRules,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/filterRules,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/synonymRules,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/redirectRules,List(JsonValidationError(List(error.path.missing),WrappedArray())))))] -play.api.UnexpectedException: Unexpected exception[JsResultException: JsResultException(errors:List((/upDownRules,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/deleteRules,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/filterRules,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/synonymRules,List(JsonValidationError(List(error.path.missing),WrappedArray()))), (/redirectRules,List(JsonValidationError(List(error.path.missing),WrappedArray())))))] -play.api.UnexpectedException: Unexpected exception[BatchUpdateException: Duplicate entry '5f4fa25d-21cd-4348-b6b0-908cafdf29e9' for key 'PRIMARY'] -play.api.UnexpectedException: Unexpected exception[BatchUpdateException: Duplicate entry 'e78aa12d-5941-4370-8489-3e15b94e02df' for key 'PRIMARY'] -play.api.UnexpectedException: Unexpected exception[SQLIntegrityConstraintViolationException: Duplicate entry 'ecommerce' for key 'solr_index_field_name'] -play.api.UnexpectedException: Unexpected exception[SQLIntegrityConstraintViolationException: Duplicate entry 'ecommerce' for key 'solr_index_field_name'] -play.api.UnexpectedException: Unexpected exception[SQLIntegrityConstraintViolationException: Duplicate entry 'ecommerce' for key 'solr_index_field_name'] -play.api.UnexpectedException: Unexpected exception[NoSuchElementException: head of empty list] \ No newline at end of file diff --git a/notes.txt b/notes.txt deleted file mode 100644 index 9420bc23..00000000 --- a/notes.txt +++ /dev/null @@ -1 +0,0 @@ -make docker-build-only \ No newline at end of file diff --git a/run.sh b/run.sh deleted file mode 100755 index 93831f91..00000000 --- a/run.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -source run_helper.sh \ No newline at end of file diff --git a/run_helper.sh b/run_helper.sh deleted file mode 100644 index 9d32e3ab..00000000 --- a/run_helper.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -source ~/.zshrc -sbt run -Dconfig.file=./smui-dev.conf 9000 \ No newline at end of file From aac937988f1cb26636da52f96f7df37c357ccf1c Mon Sep 17 00:00:00 2001 From: Chris Morley Date: Tue, 24 May 2022 15:14:42 -0400 Subject: [PATCH 3/5] catch add solr index exception in api --- app/controllers/ApiController.scala | 17 +++++++++++++---- .../rules-collection-create.component.ts | 14 ++------------ 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/app/controllers/ApiController.scala b/app/controllers/ApiController.scala index 4a6085ab..7b1c143c 100644 --- a/app/controllers/ApiController.scala +++ b/app/controllers/ApiController.scala @@ -58,11 +58,20 @@ class ApiController @Inject()(authActionFactory: AuthActionFactory, jsonBody.map { json => val searchIndexName = (json \ "name").as[String] val searchIndexDescription = (json \ "description").as[String] - val solrIndexId = searchManagementRepository.addNewSolrIndex( - SolrIndex(name = searchIndexName, description = searchIndexDescription) - ) - Ok(Json.toJson(ApiResult(API_RESULT_OK, "Successfully added Deployment Channel '" + searchIndexName + "'.", Some(solrIndexId)))) + var solrIndexId: SolrIndexId = new SolrIndexId(""); + try { + solrIndexId = searchManagementRepository.addNewSolrIndex( + SolrIndex(name = searchIndexName, description = searchIndexDescription) + ); + logger.debug("solrIndexId:" + solrIndexId); + Ok(Json.toJson(ApiResult(API_RESULT_OK, "Successfully added Deployment Channel '" + searchIndexName + "'.", Some(solrIndexId)))) + } catch { + case e: Exception => { + BadRequest(Json.toJson(ApiResult(API_RESULT_FAIL, "Could not add new Solr index. Duplicate?", None))) + }; + } + }.getOrElse { BadRequest(Json.toJson(ApiResult(API_RESULT_FAIL, "Adding new Deployment Channel failed. Unexpected body data.", None))) } diff --git a/frontend/src/app/components/admin/rules-collection-create/rules-collection-create.component.ts b/frontend/src/app/components/admin/rules-collection-create/rules-collection-create.component.ts index a678e507..10eccfb9 100644 --- a/frontend/src/app/components/admin/rules-collection-create/rules-collection-create.component.ts +++ b/frontend/src/app/components/admin/rules-collection-create/rules-collection-create.component.ts @@ -66,19 +66,9 @@ export class RulesCollectionCreateComponent implements OnInit, OnChanges { .then(() => this.clearForm()) .catch(error => { console.log(error); - var showAlreadyExists = false; var errorMsg = 'Unknown Error' - if ('status' in error) { - errorMsg += ": " + error.status; - if (error.status == 500) { - showAlreadyExists = true; - } - } - if ('statusText' in error) { - errorMsg += " " + error.statusText; - } - if (showAlreadyExists) { - errorMsg += " (Rules collection for that search engine collection already exists?)" + if ('message' in error.error) { + errorMsg = error.error.message; } this.showErrorMsg.emit(errorMsg); }); From 301d8dac6f90fc7287765c4154f4e25043812ae4 Mon Sep 17 00:00:00 2001 From: Chris Morley Date: Tue, 24 May 2022 15:25:08 -0400 Subject: [PATCH 4/5] error handling in the API when search engine collection is a duplicate --- app/controllers/ApiController.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/ApiController.scala b/app/controllers/ApiController.scala index 7b1c143c..21333c38 100644 --- a/app/controllers/ApiController.scala +++ b/app/controllers/ApiController.scala @@ -59,16 +59,16 @@ class ApiController @Inject()(authActionFactory: AuthActionFactory, val searchIndexName = (json \ "name").as[String] val searchIndexDescription = (json \ "description").as[String] - var solrIndexId: SolrIndexId = new SolrIndexId(""); try { - solrIndexId = searchManagementRepository.addNewSolrIndex( + var solrIndexId = searchManagementRepository.addNewSolrIndex( SolrIndex(name = searchIndexName, description = searchIndexDescription) ); logger.debug("solrIndexId:" + solrIndexId); Ok(Json.toJson(ApiResult(API_RESULT_OK, "Successfully added Deployment Channel '" + searchIndexName + "'.", Some(solrIndexId)))) } catch { case e: Exception => { - BadRequest(Json.toJson(ApiResult(API_RESULT_FAIL, "Could not add new Solr index. Duplicate?", None))) + logger.debug("The searchIndexDescription (Search Engine Collection Name) given was likely a duplicate."); + BadRequest(Json.toJson(ApiResult(API_RESULT_FAIL, "Could not add Rules Collection. Only one Rules Collection per Search Engine Collection is allowed.", None))) }; } From 170d1db505cea8332bceed0c0fa1af70d7b85040 Mon Sep 17 00:00:00 2001 From: Chris Morley Date: Mon, 7 Nov 2022 17:45:07 -0500 Subject: [PATCH 5/5] revert --- app/controllers/ApiController.scala | 17 ++++------------- .../rules-collection-create.component.ts | 13 +++---------- 2 files changed, 7 insertions(+), 23 deletions(-) diff --git a/app/controllers/ApiController.scala b/app/controllers/ApiController.scala index 21333c38..4a6085ab 100644 --- a/app/controllers/ApiController.scala +++ b/app/controllers/ApiController.scala @@ -58,20 +58,11 @@ class ApiController @Inject()(authActionFactory: AuthActionFactory, jsonBody.map { json => val searchIndexName = (json \ "name").as[String] val searchIndexDescription = (json \ "description").as[String] + val solrIndexId = searchManagementRepository.addNewSolrIndex( + SolrIndex(name = searchIndexName, description = searchIndexDescription) + ) - try { - var solrIndexId = searchManagementRepository.addNewSolrIndex( - SolrIndex(name = searchIndexName, description = searchIndexDescription) - ); - logger.debug("solrIndexId:" + solrIndexId); - Ok(Json.toJson(ApiResult(API_RESULT_OK, "Successfully added Deployment Channel '" + searchIndexName + "'.", Some(solrIndexId)))) - } catch { - case e: Exception => { - logger.debug("The searchIndexDescription (Search Engine Collection Name) given was likely a duplicate."); - BadRequest(Json.toJson(ApiResult(API_RESULT_FAIL, "Could not add Rules Collection. Only one Rules Collection per Search Engine Collection is allowed.", None))) - }; - } - + Ok(Json.toJson(ApiResult(API_RESULT_OK, "Successfully added Deployment Channel '" + searchIndexName + "'.", Some(solrIndexId)))) }.getOrElse { BadRequest(Json.toJson(ApiResult(API_RESULT_FAIL, "Adding new Deployment Channel failed. Unexpected body data.", None))) } diff --git a/frontend/src/app/components/admin/rules-collection-create/rules-collection-create.component.ts b/frontend/src/app/components/admin/rules-collection-create/rules-collection-create.component.ts index 10eccfb9..ea64f919 100644 --- a/frontend/src/app/components/admin/rules-collection-create/rules-collection-create.component.ts +++ b/frontend/src/app/components/admin/rules-collection-create/rules-collection-create.component.ts @@ -64,16 +64,9 @@ export class RulesCollectionCreateComponent implements OnInit, OnChanges { .then(() => this.showSuccessMsg.emit("Created new Rules Collection " + this.description)) .then(() => this.solrService.emitRulesCollectionChangeEvent("")) .then(() => this.clearForm()) - .catch(error => { - console.log(error); - var errorMsg = 'Unknown Error' - if ('message' in error.error) { - errorMsg = error.error.message; - } - this.showErrorMsg.emit(errorMsg); - }); - } else { - this.showErrorMsg.emit("Fill in both name fields."); + .catch(error => this.showErrorMsg.emit(error)); } } + + }