66 stringify ,
77 pathToRegexp ,
88 TokenData ,
9- ParseError ,
9+ PathError ,
1010} from "./index.js" ;
1111import {
1212 PARSER_TESTS ,
@@ -21,7 +21,7 @@ import {
2121describe ( "path-to-regexp" , ( ) => {
2222 describe ( "ParseError" , ( ) => {
2323 it ( "should contain original path and debug url" , ( ) => {
24- const error = new ParseError (
24+ const error = new PathError (
2525 "Unexpected END at index 7, expected }" ,
2626 "/{:foo," ,
2727 ) ;
@@ -34,7 +34,7 @@ describe("path-to-regexp", () => {
3434 } ) ;
3535
3636 it ( "should omit original url when undefined" , ( ) => {
37- const error = new ParseError (
37+ const error = new PathError (
3838 "Unexpected END at index 7, expected }" ,
3939 undefined ,
4040 ) ;
@@ -50,34 +50,31 @@ describe("path-to-regexp", () => {
5050 describe ( "parse errors" , ( ) => {
5151 it ( "should throw on unbalanced group" , ( ) => {
5252 expect ( ( ) => parse ( "/{:foo," ) ) . toThrow (
53- new ParseError ( "Unexpected END at index 7, expected }" , "/{:foo," ) ,
53+ new PathError ( "Unexpected END at index 7, expected }" , "/{:foo," ) ,
5454 ) ;
5555 } ) ;
5656
5757 it ( "should throw on nested unbalanced group" , ( ) => {
5858 expect ( ( ) => parse ( "/{:foo/{x,y}" ) ) . toThrow (
59- new ParseError (
60- "Unexpected END at index 12, expected }" ,
61- "/{:foo/{x,y}" ,
62- ) ,
59+ new PathError ( "Unexpected END at index 12, expected }" , "/{:foo/{x,y}" ) ,
6360 ) ;
6461 } ) ;
6562
6663 it ( "should throw on missing param name" , ( ) => {
6764 expect ( ( ) => parse ( "/:/" ) ) . toThrow (
68- new ParseError ( "Missing parameter name at index 2" , "/:/" ) ,
65+ new PathError ( "Missing parameter name at index 2" , "/:/" ) ,
6966 ) ;
7067 } ) ;
7168
7269 it ( "should throw on missing wildcard name" , ( ) => {
7370 expect ( ( ) => parse ( "/*/" ) ) . toThrow (
74- new ParseError ( "Missing parameter name at index 2" , "/*/" ) ,
71+ new PathError ( "Missing parameter name at index 2" , "/*/" ) ,
7572 ) ;
7673 } ) ;
7774
7875 it ( "should throw on unterminated quote" , ( ) => {
7976 expect ( ( ) => parse ( '/:"foo' ) ) . toThrow (
80- new ParseError ( "Unterminated quote at index 2" , '/:"foo' ) ,
77+ new PathError ( "Unterminated quote at index 2" , '/:"foo' ) ,
8178 ) ;
8279 } ) ;
8380 } ) ;
@@ -127,7 +124,7 @@ describe("path-to-regexp", () => {
127124 describe ( "pathToRegexp errors" , ( ) => {
128125 it ( "should throw when missing text between params" , ( ) => {
129126 expect ( ( ) => pathToRegexp ( "/:foo:bar" ) ) . toThrow (
130- new ParseError ( 'Missing text before "bar" param' , "/:foo:bar" ) ,
127+ new PathError ( 'Missing text before "bar" param' , "/:foo:bar" ) ,
131128 ) ;
132129 } ) ;
133130
@@ -139,7 +136,7 @@ describe("path-to-regexp", () => {
139136 { type : "param" , name : "b" } ,
140137 ] ) ,
141138 ) ,
142- ) . toThrow ( new ParseError ( 'Missing text before "b" param' , undefined ) ) ;
139+ ) . toThrow ( new PathError ( 'Missing text before "b" param' , undefined ) ) ;
143140 } ) ;
144141
145142 it ( "should throw with `originalPath` when missing text between params using TokenData" , ( ) => {
@@ -153,7 +150,7 @@ describe("path-to-regexp", () => {
153150 "/[a][b]" ,
154151 ) ,
155152 ) ,
156- ) . toThrow ( new ParseError ( 'Missing text before "b" param' , "/[a][b]" ) ) ;
153+ ) . toThrow ( new PathError ( 'Missing text before "b" param' , "/[a][b]" ) ) ;
157154 } ) ;
158155
159156 it ( "should contain the error line" , ( ) => {
0 commit comments