azure-sdk-for-python icon indicating copy to clipboard operation
azure-sdk-for-python copied to clipboard

[Tables] Invalid table name error doesn't indicate the issue

Open seankane-msft opened this issue 6 years ago • 1 comments

When a user attempts to create a table with an invalid name (table names must be alphanumeric) the error thrown does not give information as to what the user is doing wrong.

Traceback (most recent call last):
  File "create_table.py", line 19, in <module>
    table = service.create_table(table_name="test_table")
  File "C:\Users\Sean Kane\Documents\azure\azure-sdk-for-python\envs\py_38\lib\site-packages\azure\core\tracing\decorator.py", line 83, in wrapper_use_tracer
    return func(*args, **kwargs)
  File "c:\users\sean kane\documents\azure\azure-sdk-for-python\sdk\table\azure-table\azure\table\_table_service_client.py", line 189, in create_table     
    self._client.table.create(table_properties)
  File "c:\users\sean kane\documents\azure\azure-sdk-for-python\sdk\table\azure-table\azure\table\_generated\operations\_table_operations.py", line 204, in create
    raise HttpResponseError(response=response, model=error)
azure.core.exceptions.HttpResponseError: Operation returned an invalid status 'Bad Request'

seankane-msft avatar Jul 14 '20 21:07 seankane-msft

Thanks @seankane-msft - good catch - that is definitely an unfortunate error.... @LibbaLawrence - we may need to do some kind of regex on the table name before calling create.

This is what we were discussing this morning when I mentioned removing client-side validation to see how the service responds. In this case the service is raising a particularly unhelpful error - so client-side validation is probably a good idea.

annatisch avatar Jul 14 '20 21:07 annatisch