Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
759ee93
Basic workflow and adapter exception messages
athul-rs Feb 26, 2024
badf00d
Corrected alignment of the OnBoard page to accommodate various screen…
mohamed-siddhiq Feb 27, 2024
e839070
Merge branch 'main' into onboarding-page-alignment-fix
mohamed-siddhiq Feb 28, 2024
910e2c5
Merge branch 'main' into onboarding-page-alignment-fix
mohamed-siddhiq Feb 28, 2024
2064d49
Adapter error messages updated
athul-rs Feb 28, 2024
5d17097
Merge branch 'main' into fix/exception-handling-workflows
athul-rs Feb 28, 2024
60f062b
removed translator, PII redactor and workflow settings
muhammad-ali-e Feb 28, 2024
f9921f8
ocr tool with adapter support
vishnuszipstack Feb 28, 2024
bda3af0
Merge branch 'main' into RemoveWorkflowConfigurations
muhammad-ali-e Feb 29, 2024
f71a405
Merge branch 'main' into feature/OCR-Tool
vishnuszipstack Feb 29, 2024
8b263ed
Changed service name for document in docker compose (#17)
ritwik-g Feb 29, 2024
fc395a1
Conflict fix and additional case for connection error
athul-rs Feb 29, 2024
cd136e6
Merge branch 'main' into feature/OCR-Tool
vishnuszipstack Feb 29, 2024
4f466d6
Merge branch 'main' into fix/exception-handling-workflows
athul-rs Feb 29, 2024
8484bf6
PR comments addressed
vishnuszipstack Feb 29, 2024
b596dd3
Merge pull request #4 from Zipstack/fix/exception-handling-workflows
nehabagdia Feb 29, 2024
157a6a5
Merge branch 'main' into fix/RemoveWorkflowConfigurations
nehabagdia Feb 29, 2024
9101eab
Merge pull request #16 from Zipstack/fix/RemoveWorkflowConfigurations
nehabagdia Feb 29, 2024
77adf4f
Merge branch 'main' into feature/OCR-Tool
nehabagdia Feb 29, 2024
29df7ef
Merge branch 'main' into onboarding-page-alignment-fix
nehabagdia Feb 29, 2024
0071dd8
Merge pull request #15 from Zipstack/feature/OCR-Tool
nehabagdia Feb 29, 2024
42817ab
Merge branch 'main' into onboarding-page-alignment-fix
nehabagdia Feb 29, 2024
9a90409
Merge pull request #6 from Zipstack/onboarding-page-alignment-fix
nehabagdia Feb 29, 2024
af8134f
Merge branch 'main' into feature/App-Deployment-Chat-Engine
ritwik-g Feb 29, 2024
a01ff45
Added docker fixes
ritwik-g Feb 29, 2024
efd53fb
Merge branch 'feature/App-Deployment' into feature/App-Deployment-Doc…
ritwik-g Feb 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Basic workflow and adapter exception messages
  • Loading branch information
athul-rs committed Feb 26, 2024
commit 759ee93a72c9a32f447e6e56d13351524152b811
6 changes: 4 additions & 2 deletions backend/adapter_processor/adapter_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
)
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from platform_settings.exceptions import ActiveKeyNotFound
from platform_settings.exceptions import ActiveKeyNotFound, InvalidRequest
from platform_settings.platform_auth_service import (
PlatformAuthenticationService,
)
Expand Down Expand Up @@ -120,7 +120,9 @@ def test_adapter(adapter_id: str, adapter_metadata: dict[str, Any]) -> bool:
logger.info(f"{adapter_id} test result: {test_result}")
return test_result
except ActiveKeyNotFound:
raise
raise ActiveKeyNotFound()
except InvalidRequest as e:
raise InvalidRequest(str(e.detail))
except Exception as e:
logger.error(f"Error while testing {adapter_id}: {e}")
if isinstance(e, AdapterError):
Expand Down
26 changes: 18 additions & 8 deletions backend/adapter_processor/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,24 @@ def test(self, request: Request) -> Response:
adapter_metadata[
AdapterKeys.ADAPTER_TYPE
] = serializer.validated_data.get(AdapterKeys.ADAPTER_TYPE)
test_result = AdapterProcessor.test_adapter(
adapter_id=adapter_id, adapter_metadata=adapter_metadata
)
return Response(
{AdapterKeys.IS_VALID: test_result},
status=status.HTTP_200_OK,
)

try:
test_result = AdapterProcessor.test_adapter(
adapter_id=adapter_id, adapter_metadata=adapter_metadata
)
return Response(
{AdapterKeys.IS_VALID: test_result},
status=status.HTTP_200_OK,
)
except Exception as e:
if str(e).find("invalid_api_key") != -1:
return Response(
{"message": "Incorrect API key provided."},
status=status.HTTP_401_UNAUTHORIZED,
)
return Response(
{AdapterKeys.IS_VALID: False},
status=status.HTTP_500_INTERNAL_SERVER_ERROR,
)

class AdapterInstanceViewSet(ModelViewSet):
queryset = AdapterInstance.objects.all()
Expand Down
4 changes: 4 additions & 0 deletions backend/platform_settings/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ class ActiveKeyNotFound(APIException):
default_detail = "At least one active platform key should be available"


class InvalidRequest(APIException):
status_code = 401
default_detail = "Invalid Request"

class DuplicateData(APIException):
status_code = 400
default_detail = "Duplicate Data"
Expand Down
4 changes: 4 additions & 0 deletions backend/workflow_manager/workflow/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ class InvalidRequest(APIException):
status_code = 400
default_detail = "Invalid Request"

class MissingEnvException(APIException):
status_code = 500
default_detail = "At least one active platform key should be available."


class InternalException(APIException):
"""Internal Error.
Expand Down
11 changes: 11 additions & 0 deletions backend/workflow_manager/workflow/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
WorkflowExecutionError,
WorkflowGenerationError,
WorkflowRegenerationError,
MissingEnvException,
)
from workflow_manager.workflow.generator import WorkflowGenerator
from workflow_manager.workflow.models.workflow import Workflow
Expand Down Expand Up @@ -241,8 +242,18 @@ def execute(
status=status.HTTP_200_OK,
)
except (InvalidRequest, WorkflowExecutionError) as exception:
logger.error(f"Error while executing workflow: {exception}")
update_pipeline(pipeline_guid, Pipeline.PipelineStatus.FAILURE)
raise exception
except MissingEnvException as exception:
update_pipeline(pipeline_guid, Pipeline.PipelineStatus.FAILURE)
logger.error(f"Error while executing workflow: {exception}")
return Response(
{
"error": "Please check the logs for more details: " + str(exception)
},
status=status.HTTP_400_BAD_REQUEST
)
except Exception as exception:
logger.error(f"Error while executing workflow: {exception}")
update_pipeline(pipeline_guid, Pipeline.PipelineStatus.FAILURE)
Expand Down