Commits

Kirill Simonov  committed c5a61cd

Updated scan error messages.

  • Participants
  • Parent commits a86003d

Comments (0)

Files changed (6)

File src/htsql/tr/scan.py

                 start = len(match.string[:start].decode('utf-8', 'ignore'))
                 end = len(match.string[:end].decode('utf-8', 'ignore'))
                 mark = Mark(input, start, end)
-                raise ScanError("expected two hexdecimal digits to follow"
-                                " symbol '%s'", mark)
+                raise ScanError("symbol '%' must be followed by two hexdecimal"
+                                " digits", mark,
+                                hint="use '%25' to represent '%' literally")
             # Return the character corresponding to the escape sequence.
             return chr(int(code, 16))
 

File test/output/mssql.yaml

           headers:
           - [Content-Type, text/plain; charset=UTF-8]
           body: |
-            scan error: expected two hexdecimal digits to follow symbol '%s':
+            scan error: symbol '%' must be followed by two hexdecimal digits:
                 /%27?%@$'
                      ^
+            (use '%25' to represent '%' literally)
         - uri: /'%FF'
           status: 400 Bad Request
           headers:

File test/output/mysql.yaml

           headers:
           - [Content-Type, text/plain; charset=UTF-8]
           body: |
-            scan error: expected two hexdecimal digits to follow symbol '%s':
+            scan error: symbol '%' must be followed by two hexdecimal digits:
                 /%27?%@$'
                      ^
+            (use '%25' to represent '%' literally)
         - uri: /'%FF'
           status: 400 Bad Request
           headers:

File test/output/oracle.yaml

           headers:
           - [Content-Type, text/plain; charset=UTF-8]
           body: |
-            scan error: expected two hexdecimal digits to follow symbol '%s':
+            scan error: symbol '%' must be followed by two hexdecimal digits:
                 /%27?%@$'
                      ^
+            (use '%25' to represent '%' literally)
         - uri: /'%FF'
           status: 400 Bad Request
           headers:

File test/output/pgsql.yaml

           headers:
           - [Content-Type, text/plain; charset=UTF-8]
           body: |
-            scan error: expected two hexdecimal digits to follow symbol '%s':
+            scan error: symbol '%' must be followed by two hexdecimal digits:
                 /%27?%@$'
                      ^
+            (use '%25' to represent '%' literally)
         - uri: /'%FF'
           status: 400 Bad Request
           headers:

File test/output/sqlite.yaml

           headers:
           - [Content-Type, text/plain; charset=UTF-8]
           body: |
-            scan error: expected two hexdecimal digits to follow symbol '%s':
+            scan error: symbol '%' must be followed by two hexdecimal digits:
                 /%27?%@$'
                      ^
+            (use '%25' to represent '%' literally)
         - uri: /'%FF'
           status: 400 Bad Request
           headers: