Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handle PydanticSerializationError that generates generic errors …
…in the UI (langflow-ai#3108) * fix(main.py): handle PydanticSerializationError in JavaScriptMIMETypeMiddleware to provide detailed error message in case of serialization error * fix(main.py): handle PydanticSerializationError in JavaScriptMIMETypeMiddleware to provide detailed error message in case of serialization error * improve error handling * feat: Handle PydanticSerializationError in JavaScriptMIMETypeMiddleware Refactor the `JavaScriptMIMETypeMiddleware` class in `main.py` to handle the `PydanticSerializationError` exception. This change ensures that a detailed error message is provided in case of a serialization error. The error message is now serialized as a JSON string and included in the `detail` field of the `HTTPException` raised. * feat: Add tryParseJson function to utils.ts This commit adds a new function called `tryParseJson` to the `utils.ts` file. The function attempts to parse a JSON string and returns the parsed object. If parsing fails, it returns undefined. This function can be used to safely parse JSON strings without throwing an error. * fix: Handle error message in buildVertex function This commit modifies the buildVertex function in buildUtils.ts to handle error messages more effectively. It adds logic to extract the error message from the AxiosError response and parse it as JSON if possible. If the error message is not an array, it converts it into an array. This change ensures that the error message is properly displayed when building a component fails. * remove console.log * remove not related code --------- Co-authored-by: anovazzi1 <[email protected]> (cherry picked from commit f08467d)
- Loading branch information