Doctrine DBAL
  1. Doctrine DBAL
  2. DBAL-28

Better error messages while creating schema

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.0-BETA2
    • Fix Version/s: 2.0.0-BETA3
    • Component/s: Schema Managers
    • Labels:
      None
    • Environment:
      Linux, PostgreSQL 8.4, PHP 5.3.2

      Description

      I'd like to suggest some improvements in the schema builder concerning error messages, which do not tell the most important information needed to find the problem quickly and without irritation. Below, I present a simple case I encountered yesterday: I had a quite big schema to generate, but I made a mistake in index column names. Doctrine thrown me the following exception:

      Doctrine\DBAL\Schema\SchemaException
      An unknown column-name name was given.
      

      What I miss, is the table name, where I try to define such an index. I took a look at the messages for SchemaException and I noticed that none of them provides it, except those ones which refer directly to tables.

      Another small, but useful improvement is enclosing the table/column/index/sequence/anything-else names in quotes or double quotes in order to make them better distinguishable from the message body. My first impression from the message above was that I have a "column-name" name defined somewhere, not a column named "name".

      To sum up, the expected message should look like this:

      Doctrine\DBAL\Schema\SchemaException
      An unknown column-name 'name' was given for index 'foo' in table 'bar'.
      

      The problem is minor, but I would be grateful if you remembered about it in the near future, so that I could have more useful error messages at least in the stable releases.

        Activity

        Hide
        Benjamin Eberlei added a comment -

        fixed, changed on other exceptions also.

        Show
        Benjamin Eberlei added a comment - fixed, changed on other exceptions also.

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Tomasz Jędrzejewski
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: