Skip to content

Commit b4ba2d1

Browse files
Himanshi-MirosoftHimanshi Agrawal
andauthored
fix: exception should come in correct way to user on configuration page and corrected the message (#1291)
Co-authored-by: Himanshi Agrawal <v-himagrawal@microsoft.com>
1 parent bca3795 commit b4ba2d1

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

code/backend/batch/utilities/helpers/config/config_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ def validate_config(config: dict):
222222
and unsupported_advanced_image_processing_file_type
223223
):
224224
raise Exception(
225-
f"Advanced image processing has been enabled for document type {document_type}, but only {ADVANCED_IMAGE_PROCESSING_FILE_TYPES} file types are supported."
225+
f"Advanced image processing has not been enabled for document type {document_type}, as only {ADVANCED_IMAGE_PROCESSING_FILE_TYPES} file types are supported."
226226
)
227227

228228
@staticmethod

code/backend/pages/04_Configuration.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import os
22
import sys
3-
import traceback
43
import json
54
import jsonschema
65
import streamlit as st
@@ -438,5 +437,5 @@ def validate_documents():
438437
del st.session_state["reset"]
439438
del st.session_state["reset_configuration"]
440439

441-
except Exception:
442-
st.error(traceback.format_exc())
440+
except Exception as e:
441+
st.error(e)

code/tests/utilities/helpers/test_config_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ def test_save_config_as_active_validates_advanced_image_file_types_are_valid(
311311

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

0 commit comments

Comments
 (0)