Skip to content

Commit 7f1d520

Browse files
[MIN] RESTXQ: error messages. #1708
1 parent 96ec364 commit 7f1d520

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

basex-api/src/main/java/org/basex/http/web/WebFunction.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,13 @@ protected final QNm checkVariable(final QNm name, final boolean[] declared)
152152
* Binds a value to a function argument.
153153
* @param name variable name
154154
* @param args arguments
155-
* @param value value to be bound
155+
* @param value value to be bound (can be {@code null})
156156
* @param qc query context
157-
* @param info info string
157+
* @param input input description
158158
* @throws QueryException query exception
159159
*/
160160
protected final void bind(final QNm name, final Expr[] args, final Value value,
161-
final QueryContext qc, final String info) throws QueryException {
161+
final QueryContext qc, final String input) throws QueryException {
162162

163163
// skip nulled values
164164
if(value == null) return;
@@ -171,7 +171,7 @@ protected final void bind(final QNm name, final Expr[] args, final Value value,
171171
// casts and binds the value
172172
final SeqType st = var.declaredType();
173173
args[p] = value.seqType().instanceOf(st) ? value : st.cast(value, false, qc, null);
174-
if(args[p] == null) throw error(ARG_TYPE_X_X_X, info, st, value);
174+
if(args[p] == null) throw error(ARG_TYPE_X_X_X, input, st, value.toErrorString());
175175
break;
176176
}
177177
}

basex-api/src/main/java/org/basex/http/web/WebModules.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,8 @@ public WsFunction websocket(final WebSocket ws, final Annotation ann)
216216
*/
217217
private static String toString(final List<? extends WebFunction> funcs) {
218218
final TokenBuilder tb = new TokenBuilder();
219-
for(final WebFunction func : funcs) tb.add(Text.NL).add(Text.LI).add(func);
220-
return tb.toString();
219+
for(final WebFunction func : funcs) tb.add(tb.isEmpty() ? " " : ", ").add(func);
220+
return tb.add('.').toString();
221221
}
222222

223223
/**

basex-api/src/main/java/org/basex/http/web/WebText.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public interface WebText {
6464
/** Error message. */
6565
String INV_NONS_X = "No namespace declared for '%'.";
6666
/** Error message. */
67-
String ARG_TYPE_X_X_X = "% must be %, supplied: %.";
67+
String ARG_TYPE_X_X_X = "% must be of type %, supplied: %.";
6868
/** Error message. */
6969
String PARAM_MISSING_X = "Parameter $% missing in function declaration.";
7070
/** Error message. */
@@ -82,9 +82,9 @@ public interface WebText {
8282
/** Error message. */
8383
String BODY_TYPE_X_X = "Body cannot be parsed as %: %.";
8484
/** Error message. */
85-
String PATH_CONFLICT_X_X = "Multiple services defined for path \"%\":%";
85+
String PATH_CONFLICT_X_X = "Multiple functions exist for path \"%\":%";
8686
/** Error message. */
87-
String ERROR_CONFLICT_X_X = "Multiple services defined for error \"%\":%";
87+
String ERROR_CONFLICT_X_X = "Multiple functions exist for error path \"%\":%";
8888
/** Error message. */
8989
String ERROR_QS_X = "Invalid quality factor: qs=%";
9090
/** Error message. */

0 commit comments

Comments
 (0)