Skip to content

Commit

Permalink
pretty print
Browse files Browse the repository at this point in the history
  • Loading branch information
girarda committed Dec 21, 2022
1 parent 84bd5dc commit 0912538
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ async def read_stream(self, stream_read_request_body: StreamReadRequestBody = Bo
# 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: {error.args[0]}\n{''.join(traceback.TracebackException.from_exception(error).format())}",
detail=f"Could not perform read with with error: {error.args[0]}\n{self._get_stacktrace_as_string(error)}",
)

return StreamRead(logs=log_messages, slices=[single_slice])
Expand Down Expand Up @@ -212,5 +212,9 @@ def _create_low_code_adapter(manifest: Dict[str, Any]) -> LowCodeSourceAdapter:
# 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: {error.message}\n{''.join(traceback.TracebackException.from_exception(error).format())}",
detail=f"Invalid connector manifest with error: {error.message}\n{DefaultApiImpl._get_stacktrace_as_string(error)}",
)

@staticmethod
def _get_stacktrace_as_string(error) -> str:
return "\n".join(traceback.TracebackException.from_exception(error).format())

0 comments on commit 0912538

Please sign in to comment.