https://delta.io logo
i

Ian

04/13/2023, 5:17 PM
Hi people, how can i handle PyDeltaTableError because it keeps throwing 500 internal server error when the control reaches there only workaround was to raise an exception manually
Copy code
try:
            DeltaTable(str(delta_path))
            return True
        except PyDeltaTableError:
            raise NotFoundException(f'Delta Table not found: delta_table_path={delta_path}')
            # app_logger.error(f'Delta Table not found: delta_table_path={delta_path}')
            # return False
        except Exception as e:
            app_logger.error(e)
            return False
w

Will Jones

04/13/2023, 5:33 PM
If you are trying to map to a different error type, that seems like the appropriate way to do it
i

Ian

04/13/2023, 5:49 PM
Isn’t there a standard way to handle it ?
w

Will Jones

04/13/2023, 5:56 PM
I’m not sure what you mean by “handle it”?
What’s wrong with the
PyDeltaTableError
exception?
Is this being run inside of a webserver? And that’s converting the
PyDeltaTableError
to a 500 server error?
i

Ian

04/13/2023, 6:03 PM
yes
That is what’s happening
PyDeltaTableError
is thrown when you give an invalid path to a deltaTable instance. In my above code when i try to use expect block on it will automatically throw 500 response without even looking at any return statements but if I raise another exception inside the block i am able to counter the behaviour and log what’s written in my hardcoded exception. Thing is I dont want to do that but handle PyDeltaTableError so wen the control reaches there it returns me just false rather than 500 error
w

Will Jones

04/13/2023, 6:09 PM
I see. Could you create a reproducible example in Python and file an issue on the GitHub repo?
That sounds like a bug
i

Ian

04/13/2023, 6:12 PM
Sure I’ll raise an issue.
Thanks.
10 Views