Kirill Simonov avatar Kirill Simonov committed a40308e

Added the identifier name to the lookup error messages.

Comments (0)

Files changed (6)

src/htsql/tr/bind.py

         # Look for the identifier in the current lookup context.
         recipe = lookup_attribute(self.state.base, self.syntax.value)
         if recipe is None:
-            raise BindError("unable to resolve an identifier",
-                            self.syntax.mark)
+            raise BindError("unable to resolve an identifier: %s"
+                            % self.syntax, self.syntax.mark)
         bind = BindByRecipe(recipe, self.syntax, self.state)
         binding = bind()
         return WrapperBinding(binding, self.syntax)
         recipe = lookup_reference(self.state.base,
                                   self.syntax.identifier.value)
         if recipe is None:
-            raise BindError("unable to resolve a reference",
-                            self.syntax.mark)
+            raise BindError("unable to resolve a reference: %s"
+                            % self.syntax, self.syntax.mark)
         bind = BindByRecipe(recipe, self.syntax, self.state)
         binding = bind()
         return WrapperBinding(binding, self.syntax)
             assert isinstance(self.syntax, IdentifierSyntax)
             recipe = lookup_attribute(self.recipe.base, self.syntax.value)
             if recipe is None:
-                raise BindError("unable to resolve an identifier",
-                                self.syntax.mark)
+                raise BindError("unable to resolve an identifier: %s"
+                                % self.syntax, self.syntax.mark)
             bind = BindByRecipe(recipe, self.syntax, self.state)
             binding = bind()
             binding = DefinitionBinding(binding, self.recipe.subnames[0],

test/regress/output/mssql.yaml

           headers:
           - [Content-Type, text/plain; charset=UTF-8]
           body: |
-            bind error: unable to resolve an identifier:
+            bind error: unable to resolve an identifier: department:
                 /(prerequisite?of_department_code='capmrk'&of_course_no=818 &on_department_code='acc'&on_course_no=315).department
                                                                                                                         ^^^^^^^^^^
         - uri: /(prerequisite?of_department_code='capmrk'&of_course_no=818 &on_department_code='acc'&on_course_no=315).of_course_no
           headers:
           - [Content-Type, text/plain; charset=UTF-8]
           body: |
-            bind error: unable to resolve an identifier:
+            bind error: unable to resolve an identifier: instructor:
                 /student.instructor
                          ^^^^^^^^^^
         - uri: /school?code='mus'
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
             body: |
-              bind error: unable to resolve an identifier:
+              bind error: unable to resolve an identifier: q:
                   /define(p:=this(), q:=1){p{q}}
                                              ^
           - uri: /school.program{title, mix().name}.limit(10)
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
             body: |
-              bind error: unable to resolve an identifier:
+              bind error: unable to resolve an identifier: name:
                   /define(p:=school.program).p{title, mix().name}.limit(10)
                                                             ^^^^
         - id: link-and-fork
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
             body: |
-              bind error: unable to resolve a reference:
+              bind error: unable to resolve a reference: $year:
                   /school.define(student_by_year($year) := program.student?year(dob)=$year) {code, student_by_year(1990).$year}
                                                                                                                          ^^^^^
           - uri: /define(f($x) := $x*2){{$x, f($x)} :where $x := 21}

test/regress/output/mysql.yaml

           headers:
           - [Content-Type, text/plain; charset=UTF-8]
           body: |
-            bind error: unable to resolve an identifier:
+            bind error: unable to resolve an identifier: department:
                 /(prerequisite?of_department_code='capmrk'&of_course_no=818 &on_department_code='acc'&on_course_no=315).department
                                                                                                                         ^^^^^^^^^^
         - uri: /(prerequisite?of_department_code='capmrk'&of_course_no=818 &on_department_code='acc'&on_course_no=315).of_course_no
           headers:
           - [Content-Type, text/plain; charset=UTF-8]
           body: |
-            bind error: unable to resolve an identifier:
+            bind error: unable to resolve an identifier: instructor:
                 /student.instructor
                          ^^^^^^^^^^
         - uri: /school?code='mus'
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
             body: |
-              bind error: unable to resolve an identifier:
+              bind error: unable to resolve an identifier: q:
                   /define(p:=this(), q:=1){p{q}}
                                              ^
           - uri: /school.program{title, mix().name}.limit(10)
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
             body: |
-              bind error: unable to resolve an identifier:
+              bind error: unable to resolve an identifier: name:
                   /define(p:=school.program).p{title, mix().name}.limit(10)
                                                             ^^^^
         - id: link-and-fork
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
             body: |
-              bind error: unable to resolve a reference:
+              bind error: unable to resolve a reference: $year:
                   /school.define(student_by_year($year) := program.student?year(dob)=$year) {code, student_by_year(1990).$year}
                                                                                                                          ^^^^^
           - uri: /define(f($x) := $x*2){{$x, f($x)} :where $x := 21}

test/regress/output/oracle.yaml

           headers:
           - [Content-Type, text/plain; charset=UTF-8]
           body: |
-            bind error: unable to resolve an identifier:
+            bind error: unable to resolve an identifier: department:
                 /(prerequisite?of_department_code='capmrk'&of_course_no=818 &on_department_code='acc'&on_course_no=315).department
                                                                                                                         ^^^^^^^^^^
         - uri: /(prerequisite?of_department_code='capmrk'&of_course_no=818 &on_department_code='acc'&on_course_no=315).of_course_no
           headers:
           - [Content-Type, text/plain; charset=UTF-8]
           body: |
-            bind error: unable to resolve an identifier:
+            bind error: unable to resolve an identifier: instructor:
                 /student.instructor
                          ^^^^^^^^^^
         - uri: /school?code='mus'
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
             body: |
-              bind error: unable to resolve an identifier:
+              bind error: unable to resolve an identifier: q:
                   /define(p:=this(), q:=1){p{q}}
                                              ^
           - uri: /school.program{title, mix().name}.limit(10)
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
             body: |
-              bind error: unable to resolve an identifier:
+              bind error: unable to resolve an identifier: name:
                   /define(p:=school.program).p{title, mix().name}.limit(10)
                                                             ^^^^
         - id: link-and-fork
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
             body: |
-              bind error: unable to resolve a reference:
+              bind error: unable to resolve a reference: $year:
                   /school.define(student_by_year($year) := program.student?year(dob)=$year) {code, student_by_year(1990).$year}
                                                                                                                          ^^^^^
           - uri: /define(f($x) := $x*2){{$x, f($x)} :where $x := 21}

test/regress/output/pgsql.yaml

           headers:
           - [Content-Type, text/plain; charset=UTF-8]
           body: |
-            bind error: unable to resolve an identifier:
+            bind error: unable to resolve an identifier: department:
                 /(prerequisite?of_department_code='capmrk'&of_course_no=818 &on_department_code='acc'&on_course_no=315).department
                                                                                                                         ^^^^^^^^^^
         - uri: /(prerequisite?of_department_code='capmrk'&of_course_no=818 &on_department_code='acc'&on_course_no=315).of_course_no
           headers:
           - [Content-Type, text/plain; charset=UTF-8]
           body: |
-            bind error: unable to resolve an identifier:
+            bind error: unable to resolve an identifier: instructor:
                 /student.instructor
                          ^^^^^^^^^^
         - uri: /school?code='mus'
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
             body: |
-              bind error: unable to resolve an identifier:
+              bind error: unable to resolve an identifier: q:
                   /define(p:=this(), q:=1){p{q}}
                                              ^
           - uri: /school.program{title, mix().name}.limit(10)
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
             body: |
-              bind error: unable to resolve an identifier:
+              bind error: unable to resolve an identifier: name:
                   /define(p:=school.program).p{title, mix().name}.limit(10)
                                                             ^^^^
         - id: link-and-fork
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
             body: |
-              bind error: unable to resolve a reference:
+              bind error: unable to resolve a reference: $year:
                   /school.define(student_by_year($year) := program.student?year(dob)=$year) {code, student_by_year(1990).$year}
                                                                                                                          ^^^^^
           - uri: /define(f($x) := $x*2){{$x, f($x)} :where $x := 21}

test/regress/output/sqlite.yaml

           headers:
           - [Content-Type, text/plain; charset=UTF-8]
           body: |
-            bind error: unable to resolve an identifier:
+            bind error: unable to resolve an identifier: department:
                 /(prerequisite?of_department_code='capmrk'&of_course_no=818 &on_department_code='acc'&on_course_no=315).department
                                                                                                                         ^^^^^^^^^^
         - uri: /(prerequisite?of_department_code='capmrk'&of_course_no=818 &on_department_code='acc'&on_course_no=315).of_course_no
           headers:
           - [Content-Type, text/plain; charset=UTF-8]
           body: |
-            bind error: unable to resolve an identifier:
+            bind error: unable to resolve an identifier: instructor:
                 /student.instructor
                          ^^^^^^^^^^
         - uri: /school?code='mus'
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
             body: |
-              bind error: unable to resolve an identifier:
+              bind error: unable to resolve an identifier: q:
                   /define(p:=this(), q:=1){p{q}}
                                              ^
           - uri: /school.program{title, mix().name}.limit(10)
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
             body: |
-              bind error: unable to resolve an identifier:
+              bind error: unable to resolve an identifier: name:
                   /define(p:=school.program).p{title, mix().name}.limit(10)
                                                             ^^^^
         - id: link-and-fork
             headers:
             - [Content-Type, text/plain; charset=UTF-8]
             body: |
-              bind error: unable to resolve a reference:
+              bind error: unable to resolve a reference: $year:
                   /school.define(student_by_year($year) := program.student?year(dob)=$year) {code, student_by_year(1990).$year}
                                                                                                                          ^^^^^
           - uri: /define(f($x) := $x*2){{$x, f($x)} :where $x := 21}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.