@@ -11,7 +11,7 @@ export const count = new NumberFunction(
1111 const results = expression ! . evaluate ( context ) ;
1212
1313 if ( results . nodes == null ) {
14- throw 'todo not a node-set' ;
14+ throw new Error ( 'Expected a node-set for count function, but received null.' ) ;
1515 }
1616
1717 return new Set ( results . nodes ) . size ;
@@ -64,7 +64,7 @@ export const localName = new StringFunction(
6464 const evaluated = expression ?. evaluate ( context ) ?? context ;
6565
6666 if ( ! ( evaluated instanceof LocationPathEvaluation ) ) {
67- throw 'todo not a node-set' ;
67+ throw new Error ( 'Expected a node-set for local-name function, but received an invalid type.' ) ;
6868 }
6969
7070 const node = evaluated . first ( ) ?. value ;
@@ -95,7 +95,7 @@ export const name = new StringFunction(
9595 const evaluated = expression ?. evaluate ( context ) ?? context ;
9696
9797 if ( ! ( evaluated instanceof LocationPathEvaluation ) ) {
98- throw 'todo not a node-set' ;
98+ throw new Error ( 'Expected a node-set for name function, but received an invalid type.' ) ;
9999 }
100100
101101 const node = evaluated . first ( ) ?. value ;
@@ -125,7 +125,7 @@ export const namespaceURI = new StringFunction(
125125 const evaluated = expression ?. evaluate ( context ) ?? context ;
126126
127127 if ( ! ( evaluated instanceof LocationPathEvaluation ) ) {
128- throw 'todo not a node-set' ;
128+ throw new Error ( 'Expected a node-set for namespace-uri function, but received an invalid type.' ) ;
129129 }
130130
131131 const node = evaluated . first ( ) ?. value ;
0 commit comments