Skip to content

Commit

Permalink
fix: exception should come in correct way to user on configuration pa…
Browse files Browse the repository at this point in the history
…ge and corrected the message (#1291)

Co-authored-by: Himanshi Agrawal <[email protected]>
  • Loading branch information
Himanshi-Mirosoft and Himanshi Agrawal committed Sep 10, 2024
1 parent bca3795 commit b4ba2d1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def validate_config(config: dict):
and unsupported_advanced_image_processing_file_type
):
raise Exception(
f"Advanced image processing has been enabled for document type {document_type}, but only {ADVANCED_IMAGE_PROCESSING_FILE_TYPES} file types are supported."
f"Advanced image processing has not been enabled for document type {document_type}, as only {ADVANCED_IMAGE_PROCESSING_FILE_TYPES} file types are supported."
)

@staticmethod
Expand Down
5 changes: 2 additions & 3 deletions code/backend/pages/04_Configuration.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os
import sys
import traceback
import json
import jsonschema
import streamlit as st
Expand Down Expand Up @@ -438,5 +437,5 @@ def validate_documents():
del st.session_state["reset"]
del st.session_state["reset_configuration"]

except Exception:
st.error(traceback.format_exc())
except Exception as e:
st.error(e)
2 changes: 1 addition & 1 deletion code/tests/utilities/helpers/test_config_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def test_save_config_as_active_validates_advanced_image_file_types_are_valid(

# then
assert str(e.value) == (
"Advanced image processing has been enabled for document type txt, but only ['jpeg', 'jpg', 'png', 'tiff', 'bmp'] file types are supported."
"Advanced image processing has not been enabled for document type txt, as only ['jpeg', 'jpg', 'png', 'tiff', 'bmp'] file types are supported."
)
AzureBlobStorageClientMock.assert_not_called()

Expand Down

0 comments on commit b4ba2d1

Please sign in to comment.