From d0860d4fd002fa3829feffff95c2ead032e6887f Mon Sep 17 00:00:00 2001 From: Lake Mossman Date: Fri, 18 Nov 2022 10:12:27 -0800 Subject: [PATCH] go back to concise connector builder server error messages (#19609) --- .../connector_builder/impl/default_api.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/airbyte-connector-builder-server/connector_builder/impl/default_api.py b/airbyte-connector-builder-server/connector_builder/impl/default_api.py index fba0626ace9..4a46c87834e 100644 --- a/airbyte-connector-builder-server/connector_builder/impl/default_api.py +++ b/airbyte-connector-builder-server/connector_builder/impl/default_api.py @@ -97,7 +97,7 @@ spec: ) ) except Exception as error: - raise HTTPException(status_code=400, detail=f"Could not list streams with with error: {str(error)}") + raise HTTPException(status_code=400, detail=f"Could not list streams with with error: {error.args[0]}") return StreamsListRead(streams=stream_list_read) async def read_stream(self, stream_read_request_body: StreamReadRequestBody = Body(None, description="")) -> StreamRead: @@ -121,7 +121,7 @@ spec: single_slice.pages.append(message_group) except Exception as error: # TODO: We're temporarily using FastAPI's default exception model. Ideally we should use exceptions defined in the OpenAPI spec - raise HTTPException(status_code=400, detail=f"Could not perform read with with error: {str(error)}") + raise HTTPException(status_code=400, detail=f"Could not perform read with with error: {error.args[0]}") return StreamRead(logs=log_messages, slices=[single_slice]) @@ -199,6 +199,6 @@ spec: def _create_low_code_adapter(manifest: Dict[str, Any]) -> LowCodeSourceAdapter: try: return LowCodeSourceAdapter(manifest=manifest) - except Exception as error: + except ValidationError as error: # TODO: We're temporarily using FastAPI's default exception model. Ideally we should use exceptions defined in the OpenAPI spec - raise HTTPException(status_code=400, detail=f"Invalid connector manifest with error: {str(error)}") + raise HTTPException(status_code=400, detail=f"Invalid connector manifest with error: {error.message}")