MCPcopy Create free account
hub / github.com/BaseXdb/basex / error

Method error

basex-core/src/main/java/org/basex/core/Sandbox.java:189–208  ·  view source on GitHub ↗

Checks if a query yields the specified error code. @param query query string @param error allowed errors

(final String query, final QueryError... error)

Source from the content-addressed store, hash-verified

187 * @param error allowed errors
188 */
189 protected static void error(final String query, final QueryError... error) {
190 if(OUTPUT) {
191 Util.errln(query.strip());
192 if(error.length > 0) Util.errln(error[0]);
193 }
194 try {
195 final String res = eval(query);
196 final TokenBuilder tb = new TokenBuilder().add("Query did not fail:\n");
197 tb.add(query).add("\n[E] Error: ");
198 for(final QueryError e : error) tb.add(' ').add(e.qname().prefixId());
199 fail(tb.add("\n[F] ").add(res).toString());
200 } catch(final QueryIOException ex) {
201 error(query, ex.getCause(), error);
202 } catch(final QueryException ex) {
203 error(query, ex, error);
204 } catch(final Exception ex) {
205 Util.stack(ex);
206 fail(ex);
207 }
208 }
209
210 /**
211 * Checks if an exception yields one of the specified error codes.

Callers

nothing calls this directly

Calls 15

errlnMethod · 0.95
evalMethod · 0.95
addMethod · 0.95
stackMethod · 0.95
toStringMethod · 0.95
stripMethod · 0.80
prefixIdMethod · 0.80
addMethod · 0.65
toStringMethod · 0.65
eqMethod · 0.65
nameMethod · 0.65
qnameMethod · 0.45

Tested by

no test coverage detected