Changes

Jump to navigation Jump to search
1,761 bytes added ,  12:22, 29 July 2020
no edit summary
This article is part of the [[XQuery|XQuery Portal]].It summarizes the codes of errors that are raised by thestandard features and functions of XQuery. As the original specificationsare pretty comprehensive, we tried our best to make this overviewcomprehensible to a wider range of readers.
The following tables list the error codes that are known to BaseX,a short description, and examples of queries raising that errors.Errors that are specific to BaseX can be found in the descriptionsof the respective [[Module Library|modules]].
Original definitions of the error codes are found in the[httphttps://www.w3.org/TR/xquery-30/ XQuery 3.0],[httphttps://www.w3.org/TR/xpath-functions-3031/ XQuery 3.0 Functions],[httphttps://www.w3.org/TR/xquery-update-10/ XQuery 1.0 Update],[httphttps://www.w3.org/TR/xpath-full-text-10/ XQuery 1.0 Full Text],and [http://www.expath.org/spec/http-client EXPath HTTP]Specifications.
=Static Errors=
Error * Namespace URI: <code><nowiki>http://www.w3.org/2005/xqt-errors</nowiki></code>* Namespace prefix: <code>err</code>* Codes: {{Code|XPST}}, {{Code|XQST}}
{| class="wikitable" width="100%"
! width="110"|Code
! width="50%" |Description
|!Examples
|- valign="top" scope="row"
|<code>XPST0003</code>
|An error occurred while ''parsing'' the query string (i.e., before the query could be compiled and executed). This error is the most common one, and may be accompanied by a variety of different error messages.
|<code>1+<hrbr/>for i in //* return $i</code>
|- valign="top" scope="row"
|<code>XPST0005</code>
|<code>XPST0008</code>
|A variable or type name is used that has not been defined in the current scope.
|<code>$a---<hrbr/>element(*, x)</code>
|- valign="top" scope="row"
|<code>XPST0017</code>
| • The specified function is unknown,<br />• it uses the wrong number of arguments, or, when calling Java functions:<br />• there is more than one function with the same number of arguments.|<code>unknown()<hrbr/>count(1,2,3)</code>
|- valign="top" scope="row"
|<code>XPST0051</code>
| An unknown QName is used in a ''sequence type'' (e.g. in the target type of the {{Code|cast}} expression).
|<code>1 instance of x<hrbr/>"test"&nbsp;cast&nbsp;as&nbsp;xs:itr</code>
|- valign="top" scope="row"
|<code>XPST0080</code>
|<code>XPST0081</code>
| • A QName uses a prefix that has not been bound to any namespace, or<br />• a pragma or option declaration has not been prefixed.
|<code>unknown:x<hrbr/>(# pragma #) { 1 }</code>
|-
| colspan=3 style="background-color:white;"|
=Type Errors=
Error * Namespace URI: <code><nowiki>http://www.w3.org/2005/xqt-errors</nowiki></code>* Namespace prefix: <code>err</code>* Codes: {{Code|XPTY}}, {{Code|XQTY}}
{| class="wikitable" width="100%"
! width="110"|Code
! width="50%" |Description
|!Examples
|- valign="top" scope="row"
|<code>XPTY0004</code>
| This error is raised if an expression has the wrong type, or cannot be cast into the specified type. It may be raised both statically (during query compilation) or dynamically (at runtime).
|<code>1 + "A"<hrbr/>abs("a")<hrbr/>1 cast as xs:gYear</code>
|- valign="top" scope="row"
|<code>XPTY0018</code>
=Dynamic Errors=
Error * Namespace URI: <code><nowiki>http://www.w3.org/2005/xqt-errors</nowiki></code>* Namespace prefix: <code>err</code>* Codes: {{Code|XPDY}}, {{Code|XQDY}}
{| class="wikitable" width="100%"
! width="110"|Code
! width="50%" |Description
|!Examples
|- valign="top" scope="row"
|<code>XPDY0002</code>
| • No value has been defined for an external variable, or<br />• no context item has been set before the query was executed.
|<code>declare variable $x external; $x<hrbr/>descendant::*</code>
|- valign="top" scope="row"
|<code>XPDY0050</code>
| • The operand type of a {{Code|treat}} expression does not match the type of the argument, or<br/>• the root of the context item must be a document node.
|<code>"string" treat as xs:int<hrbr/>"string"[/]</code>
|-
| colspan=3 style="background-color:white;"|
=Functions Errors=
Error * Namespace URI: <code><nowiki>http://www.w3.org/2005/xqt-errors</nowiki></code>* Namespace prefix: <code>err</code>* Codes: {{Code|FOAR}}, {{Code|FOCA}}, {{Code|FOCH}}, {{Code|FODC}}, {{Code|FODF}}, {{Code|FODT}}, {{Code|FOER}}, {{Code|FOFD}}, {{Code|FONS}}, {{Code|FORG}}, {{Code|FORX}}, {{Code|FOTY}}, {{Code|FOUT}}
{| class="wikitable" width="100%"
! width="110"|Code
! width="50%" |Description
|!Examples
|- valign="top" scope="row"
|<code>FOAR0001</code>
|<code>FOAR0002</code>
| A numeric declaration or operation causes an over- or underflow.
|<code>12345678901234567890<hrbr/>xs:double("-INF") idiv 1</code>
|-
| colspan=3 style="background-color:white;"|
|<code>FOCA0002</code>
| • A float number cannot be converted to a decimal or integer value, or<br />• a function argument cannot be converted to a valid QName.
|<code>xs:int(xs:double("INF"))<hrbr/>QName("", "el em")</code>
|- valign="top" scope="row"
|<code>FOCA0003</code>
|<code>FORG0001</code>
| A value cannot be cast to the required target type.
|<code>xs:integer("A")<hrbr/>1 + <x>a</x></code>
|- valign="top" scope="row"
|<code>FORG0002</code>
=Serialization Errors=
Error * Namespace URI: <code><nowiki>http://www.w3.org/2005/xqt-errors</nowiki></code>* Namespace prefix: <code>err</code>* Codes: {{Code|SEPM}}, {{Code|SERE}}, {{Code|SESU}}
{| class="wikitable" width="100%"
! width="110"|Code
! width="50%" |Description
|!Examples
|- valign="top" scope="row"
|<code>SESU0007</code>
=Update Errors=
Error * Namespace URI: <code><nowiki>http://www.w3.org/2005/xqt-errors</nowiki></code>* Namespace prefix: <code>err</code>* Codes: {{Code|FOUP}}, {{Code|XUDY}}, {{Code|XUST}}, {{Code|XUTY}}
{| class="wikitable" width="100%"
! width="110"|Code
! width="50%" |Description
|!Examples
|- valign="top" scope="row"
|<code>FOUP0001</code>
=Full-Text Errors=
Error * Namespace URI: <code><nowiki>http://www.w3.org/2005/xqt-errors</nowiki></code>* Namespace prefix: <code>err</code>* Codes: {{Code|FTDY}}, {{Code|FTST}}
{| class="wikitable" width="100%"
! width="110"|Code
! width="50%" |Description
|!Examples
|- valign="top" scope="row"
|<code>FTDY0016</code>
=BaseX Errors=
Error Codes* Namespace URI: {{Code|BASX}}<code><nowiki>http://basex.org</nowiki></code>* Namespace prefix: <code>basex</code>
{| class="wikitable" width="100%"
! width="110"|Code
! widthDescription!Examples|- valign="50top" scope="row"|<code>annotation</code>| Annotation errors.|<code>%basex:xyz function() { 123 }</code>|- valign=" top" scope="row"|<code>doc</code>| The argument specified via fn:doc must yield a single document.|Description<code>doc('db-collection')</code>|- valign="top" scope="row"|<code>error</code>| Generic error, which is e. g. raised by [[Java Bindings#Integration|Java bindings]].|Examples<code>import module namespace qm='java:org.basex.query.func.QueryModuleTest';<br/>qm:error()</code>
|- valign="top" scope="row"
|<code>BASX0000function</code>| Generic error, which is used for exceptions in [[Java Bindings#Context-Awareness|context-aware Java bindings]]Function items cannot be cached.|<code>db:output(true#0)</code>
|- valign="top" scope="row"
|<code>BASX0001http</code>| The current user has insufficient [[User Management|permissions]] to execute function was called outside an expressionHTTP servlet context.|<code>filesession:deleteget('file.txtabc')</code>: ''Create'' rights needed.
|- valign="top" scope="row"
|<code>BASX0002options</code>
| The specified database option is unknown.
|<code>declare option db:xyz "'no"'; 1</code>
|- valign="top" scope="row"
|<code>BASX0003overflow</code>| Stack overflow.|<code>declare function local:a() { local:b() + 1 };<br/>declare function local:b() { local:a() + 2 };<br/>local:a()</code>|- valign="top" scope="row"|<code>permission</code>| The current user has insufficient [[User Management|permissions]] to open a database, update nodes, etc.|<code>db:open('admin')</code>|- valign="top" scope="row"|<code>restxq</code>
| Errors related to [[RESTXQ]].
|<code>%restxq:GET('x')</code>
|- valign="top" scope="row"
|<code>update</code>
| BaseX-specific update errors.
|<code><a/> update db:output('bla')</code>
|}
Additional, module-specific error codes are listed in the descriptions of the query modules.
 
[[Category:XQuery]]
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu