@@ -11,7 +11,7 @@ export const count = new NumberFunction(
11
11
const results = expression ! . evaluate ( context ) ;
12
12
13
13
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.' ) ;
15
15
}
16
16
17
17
return new Set ( results . nodes ) . size ;
@@ -64,7 +64,7 @@ export const localName = new StringFunction(
64
64
const evaluated = expression ?. evaluate ( context ) ?? context ;
65
65
66
66
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.' ) ;
68
68
}
69
69
70
70
const node = evaluated . first ( ) ?. value ;
@@ -95,7 +95,7 @@ export const name = new StringFunction(
95
95
const evaluated = expression ?. evaluate ( context ) ?? context ;
96
96
97
97
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.' ) ;
99
99
}
100
100
101
101
const node = evaluated . first ( ) ?. value ;
@@ -125,7 +125,7 @@ export const namespaceURI = new StringFunction(
125
125
const evaluated = expression ?. evaluate ( context ) ?? context ;
126
126
127
127
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.' ) ;
129
129
}
130
130
131
131
const node = evaluated . first ( ) ?. value ;
0 commit comments