Kirill Simonov avatar Kirill Simonov committed c5a61cd

Updated scan error messages.

Comments (0)

Files changed (6)

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))
 

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:

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:

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:

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:

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:
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.