Merge lp:~zorba-coders/zorba/bug-1111786 into lp:zorba

Proposed by Paul J. Lucas on 2013-02-07
Status: Merged
Approved by: Matthias Brantner on 2013-02-09
Approved revision: 11232
Merged at revision: 11230
Proposed branch: lp:~zorba-coders/zorba/bug-1111786
Merge into: lp:zorba
Diff against target: 1142 lines (+660/-99)
26 files modified
ChangeLog (+1/-0)
doc/zorba/errors_warnings.dox (+62/-9)
include/zorba/internal/diagnostic.h (+24/-0)
include/zorba/xquery_exception.h (+75/-0)
src/compiler/codegen/plan_visitor.cpp (+9/-0)
src/compiler/expression/expr.h (+3/-0)
src/compiler/translator/translator.cpp (+14/-1)
src/diagnostics/diagnostic.cpp (+9/-0)
src/diagnostics/diagnostic_en.xml (+4/-0)
src/diagnostics/pregenerated/dict_en.cpp (+1/-0)
src/diagnostics/pregenerated/dict_zed_keys.h (+1/-0)
src/diagnostics/xquery_exception.cpp (+52/-0)
src/diagnostics/xquery_exception.h (+106/-0)
src/runtime/core/trycatch.cpp (+88/-0)
src/runtime/core/trycatch.h (+3/-0)
src/runtime/json/common.cpp (+10/-0)
src/runtime/json/common.h (+7/-0)
src/runtime/json/json_impl.cpp (+53/-25)
src/runtime/json/json_loader.cpp (+69/-40)
src/store/naive/loader_fast.cpp (+26/-24)
test/rbkt/ExpQueryResults/zorba/error/data-location-json-1.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/error/data-location-xml-1.xml.res (+1/-0)
test/rbkt/Queries/zorba/error/data-location-json-1.xq (+23/-0)
test/rbkt/Queries/zorba/error/data-location-xml-1.xq (+13/-0)
test/rbkt/Queries/zorba/error/data-location.json (+3/-0)
test/rbkt/Queries/zorba/error/data-location.xml (+2/-0)
To merge this branch: bzr merge lp:~zorba-coders/zorba/bug-1111786
Reviewer Review Type Date Requested Status
Matthias Brantner 2013-02-07 Approve on 2013-02-09
Paul J. Lucas Approve on 2013-02-07
Review via email: mp+147020@code.launchpad.net

Commit message

Added $zerr:data-uri, $zerr:data-line-number, and $zerr:data-column-number.

Description of the change

Added $zerr:data-uri, $zerr:data-line-number, and $zerr:data-column-number.

To post a comment you must log in.
Paul J. Lucas (paul-lucas) :
review: Approve
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job bug-1111786-2013-02-07T04-42-25.453Z is finished. The final status was:

All tests succeeded!

Zorba Build Bot (zorba-buildbot) wrote :

Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1, Needs Fixing < 1, Pending < 1. Got: 1 Approve.

There are no tests

review: Needs Fixing
Paul J. Lucas (paul-lucas) wrote :

Do I have to add the file-name to streamable strings for this?

I think we can make this a separate item.

On Feb 7, 2013, at 6:35 AM, Paul J. Lucas <email address hidden> wrote:

> Do I have to add the file-name to streamable strings for this?
> --
> https://code.launchpad.net/~zorba-coders/zorba/bug-1111786/+merge/147020
> You are reviewing the proposed merge of lp:~zorba-coders/zorba/bug-1111786 into lp:zorba.

lp:~zorba-coders/zorba/bug-1111786 updated on 2013-02-08
11229. By Paul J. Lucas on 2013-02-08

Added tests.

The code is good. However, the documentation of the variables should be added to doc/zorba/errors_warnings.dox (there is already a section that describes other available variables).

review: Needs Fixing
lp:~zorba-coders/zorba/bug-1111786 updated on 2013-02-09
11230. By Paul J. Lucas on 2013-02-09

Added documentation for mroe Zorba error variables.

11231. By Paul J. Lucas on 2013-02-09

Merge from trunk.

11232. By Paul J. Lucas on 2013-02-09

Said what "data file" means.

review: Approve
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job bug-1111786-2013-02-09T01-38-50.87Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog'
2--- ChangeLog 2013-02-08 23:40:49 +0000
3+++ ChangeLog 2013-02-09 01:33:26 +0000
4@@ -19,6 +19,7 @@
5 Bug Fixes/Other Changes:
6 * Fixed bug #867027 (XQST0059 error messages inconsistent)
7 * Fixed bug #1095889 (Improve error message for xml-parsing error).
8+ * Fixed bug #1111786 (xml/json parse error location in catch clause).
9 * NaN items are considered equal to each other during grouping
10 * Fixed bug #855481 (Too small time types on Windows).
11 * Fixed bug in computing the static type of an allowing-empty FOR variable.
12
13=== modified file 'doc/zorba/errors_warnings.dox'
14--- doc/zorba/errors_warnings.dox 2012-09-19 21:16:15 +0000
15+++ doc/zorba/errors_warnings.dox 2013-02-09 01:33:26 +0000
16@@ -57,18 +57,70 @@
17 Please take a look at the C++ examples that show how to deal with errors and warnings in the C++ API (<a href="../../cxx/html/errors_8cpp-example.html">errors.cpp</a>).
18
19 \section try_catch Try/Catch Expressions
20-The XQuery <a href="http://www.w3.org/TR/xquery-30/#id-try-catch">try/catch expression</a> provides error handling for dynamic errors and type errors raised during dynamic evaluation.
21-For example,
22+The XQuery
23+<a href="http://www.w3.org/TR/xquery-30/#id-try-catch">try/catch expression</a>
24+provides error handling for dynamic errors and type errors
25+raised during dynamic evaluation.
26+For example:
27
28 \include zorba/trycatch/trycatch_doc_example_01.xq
29
30-Withing the catch expression, a couple of implicit variables are declared.
31-Some of them (e.g.<tt>\$err:code</tt>, <tt>\$err:description</tt>, or <tt>\$err:line-number</tt>) are defined by the XQuery set of specifications.
32-They are contained in XQuery's error namespace http://www.w3.org/2005/xqt-errors (prefix <tt>err</tt>).
33-Zorba defines an additional implicit variable that contains the stack trace of the error as an element.
34-The name of the variable is <tt>\$zerr:stack-trace</tt> where the <tt>zerr</tt> prefix is bound to the namespace %http://www.zorba-xquery.com/errors.
35-
36-For example, the query
37+Within the \c catch expression,
38+a few implicit variables are defined.
39+Some of them
40+(e.g., <tt>\$err:code</tt>,
41+<tt>\$err:description</tt>,
42+and <tt>\$err:line-number</tt>)
43+are defined by the
44+<a href="http://www.w3.org/TR/xquery-30/#id-try-catch">XQuery</a>
45+specification.
46+
47+Zorba defines additional implicit variables:
48+
49+<table>
50+ <tr>
51+ <th>Variable</th>
52+ <th>Type</th>
53+ <th>Value</th>
54+ </tr>
55+ <tr>
56+ <td>\c $zerr:data-uri</td>
57+ <td>\c xs:string?</td>
58+ <td>
59+ The URI of the data file containing the error.
60+ </td>
61+ </tr>
62+ <tr>
63+ <td>\c $zerr:data-line-number</td>
64+ <td>\c xs:integer?</td>
65+ <td>
66+ The line number within the data file where the error occurred.
67+ The value \e may be approximate.
68+ </td>
69+ </tr>
70+ <tr>
71+ <td>\c $zerr:data-column-number</td>
72+ <td>\c xs:integer?</td>
73+ <td>
74+ The column number within the data file where the error occurred.
75+ The value \e may be approximate.
76+ </td>
77+ </tr>
78+ <tr>
79+ <td>\c $zerr:stack-trace</td>
80+ <td>\c item()?</td>
81+ <td>
82+ The XQuery function call stack-trace
83+ leading up to the error.
84+ </td>
85+ </tr>
86+</table>
87+
88+where the \c zerr prefix
89+is bound to the namespace \c %http://www.zorba-xquery.com/errors
90+and "data file" refers to the file that data is being read from,
91+e.g., the result of reading XML (<tt>fn:doc</tt>) or JSON data.
92+For example, the query:
93
94 \code
95 declare namespace zerr = "http://www.zorba-xquery.com/errors";
96@@ -107,3 +159,4 @@
97 \endcode
98
99 */
100+/* vim:set et sw=2 ts=2: */
101
102=== modified file 'include/zorba/internal/diagnostic.h'
103--- include/zorba/internal/diagnostic.h 2013-01-24 04:23:25 +0000
104+++ include/zorba/internal/diagnostic.h 2013-02-09 01:33:26 +0000
105@@ -200,10 +200,34 @@
106 line_type line_end_;
107 column_type column_end_;
108
109+ friend bool operator==( location const&, location const& );
110+
111 // for plan serialization
112 friend void serialization::operator&( serialization::Archiver&, location& );
113 };
114
115+/**
116+ * \internal
117+ * Compares two locations for equality.
118+ *
119+ * @param i The first location.
120+ * @param j The second location.
121+ * @return Returns \c true only if the two locations are equal.
122+ */
123+bool operator==( location const &i, location const &j );
124+
125+/**
126+ * \internal
127+ * Compares two locations for inequality.
128+ *
129+ * @param i The first location.
130+ * @param j The second location.
131+ * @return Returns \c true only if the two locations are not equal.
132+ */
133+inline bool operator!=( location const &i, location const &j ) {
134+ return !(i == j);
135+}
136+
137 ///////////////////////////////////////////////////////////////////////////////
138
139 /**
140
141=== modified file 'include/zorba/xquery_exception.h'
142--- include/zorba/xquery_exception.h 2012-12-20 19:37:19 +0000
143+++ include/zorba/xquery_exception.h 2013-02-09 01:33:26 +0000
144@@ -138,6 +138,77 @@
145 return source_loc_.column_end();
146 }
147
148+ ////////// data file/line location //////////////////////////////////////////
149+
150+ /**
151+ * Checks whether the XQuery data location has been set.
152+ *
153+ * @return Returns \c true only if the data location has been set.
154+ */
155+ bool has_data() const throw() {
156+ return data_loc_;
157+ }
158+
159+ /**
160+ * Sets the XQuery source-code data URI name, line, and column numbers.
161+ *
162+ * @param uri The source-code data URI name. Must not be null.
163+ * @param line The source-code data URI line number.
164+ * @param column The source-code data URI column number.
165+ * @param line_end The source-code data URI end line number.
166+ * @param column_end The source-code data URI end column number.
167+ */
168+ void set_data( char const *uri,
169+ line_type line,
170+ column_type column = 0,
171+ line_type line_end = 0,
172+ column_type column_end = 0 );
173+
174+ /**
175+ * Gets the data URI containing the error.
176+ *
177+ * @return Returns said URI or the empty string if unset.
178+ */
179+ char const* data_uri() const throw() {
180+ return data_loc_.file();
181+ }
182+
183+ /**
184+ * Gets the data line number containing the error.
185+ *
186+ * @return Returns said line number or 0 if unset.
187+ */
188+ line_type data_line() const throw() {
189+ return data_loc_.line();
190+ }
191+
192+ /**
193+ * Gets the data column number containing the error.
194+ *
195+ * @return Returns said column number or 0 if unset.
196+ */
197+ column_type data_column() const throw() {
198+ return data_loc_.column();
199+ }
200+
201+ /**
202+ * Gets the data end line number containing the error.
203+ *
204+ * @return Returns said line number or 0 if unset.
205+ */
206+ line_type data_line_end() const throw() {
207+ return data_loc_.line_end();
208+ }
209+
210+ /**
211+ * Gets the data end column number containing the error.
212+ *
213+ * @return Returns said column number or 0 if unset.
214+ */
215+ column_type data_column_end() const throw() {
216+ return data_loc_.column_end();
217+ }
218+
219 ////////// "applied at" file/line location //////////////////////////////////
220
221 /**
222@@ -287,6 +358,7 @@
223 line_type raise_line, char const *message );
224
225 location source_loc_;
226+ location data_loc_;
227 location applied_loc_;
228 XQueryStackTrace query_trace_;
229
230@@ -305,6 +377,9 @@
231 friend void set_applied( ZorbaException&, char const*, line_type, column_type,
232 line_type, column_type, bool );
233
234+ friend void set_data( ZorbaException&, char const*, line_type, column_type,
235+ line_type, column_type, bool );
236+
237 friend void set_source( ZorbaException&, char const*, line_type, column_type,
238 line_type, column_type, bool );
239
240
241=== modified file 'src/compiler/codegen/plan_visitor.cpp'
242--- src/compiler/codegen/plan_visitor.cpp 2013-01-11 22:58:12 +0000
243+++ src/compiler/codegen/plan_visitor.cpp 2013-02-09 01:33:26 +0000
244@@ -2078,6 +2078,15 @@
245 case catch_clause::err_column_no:
246 rcc.theVars[TryCatchIterator::CatchClause::err_column_no] = *vec;
247 break;
248+ case catch_clause::zerr_data_uri:
249+ rcc.theVars[TryCatchIterator::CatchClause::zerr_data_uri] = *vec;
250+ break;
251+ case catch_clause::zerr_data_line_no:
252+ rcc.theVars[TryCatchIterator::CatchClause::zerr_data_line_no] = *vec;
253+ break;
254+ case catch_clause::zerr_data_column_no:
255+ rcc.theVars[TryCatchIterator::CatchClause::zerr_data_column_no] = *vec;
256+ break;
257 case catch_clause::zerr_stack_trace:
258 rcc.theVars[TryCatchIterator::CatchClause::zerr_stack_trace] = *vec;
259 break;
260
261=== modified file 'src/compiler/expression/expr.h'
262--- src/compiler/expression/expr.h 2013-01-11 22:58:12 +0000
263+++ src/compiler/expression/expr.h 2013-02-09 01:33:26 +0000
264@@ -949,6 +949,9 @@
265 err_module,
266 err_line_no,
267 err_column_no,
268+ zerr_data_uri,
269+ zerr_data_line_no,
270+ zerr_data_column_no,
271 zerr_stack_trace
272 };
273
274
275=== modified file 'src/compiler/translator/translator.cpp'
276--- src/compiler/translator/translator.cpp 2013-02-08 01:58:24 +0000
277+++ src/compiler/translator/translator.cpp 2013-02-09 01:33:26 +0000
278@@ -7851,7 +7851,8 @@
279
280 push_scope();
281
282- store::Item_t lCode, lDesc, lValue, lModule, lLineNo, lColumnNo, lStackTrace;
283+ store::Item_t lCode, lDesc, lValue, lModule, lLineNo, lColumnNo,
284+ lDataURI, lDataLineNo, lDataColumnNo, lStackTrace;
285
286 GENV_ITEMFACTORY->createQName(lCode, XQUERY_ERR_NS, "", "code");
287 GENV_ITEMFACTORY->createQName(lDesc, XQUERY_ERR_NS, "", "description");
288@@ -7859,6 +7860,9 @@
289 GENV_ITEMFACTORY->createQName(lModule, XQUERY_ERR_NS, "", "module");
290 GENV_ITEMFACTORY->createQName(lLineNo, XQUERY_ERR_NS, "", "line-number");
291 GENV_ITEMFACTORY->createQName(lColumnNo, XQUERY_ERR_NS, "", "column-number");
292+ GENV_ITEMFACTORY->createQName(lDataURI, ZORBA_ERR_NS, "", "data-uri");
293+ GENV_ITEMFACTORY->createQName(lDataLineNo, ZORBA_ERR_NS, "", "data-line-number");
294+ GENV_ITEMFACTORY->createQName(lDataColumnNo, ZORBA_ERR_NS, "", "data-column-number");
295 GENV_ITEMFACTORY->createQName(lStackTrace, ZORBA_ERR_NS, "", "stack-trace");
296
297 cc->add_var(catch_clause::err_code,
298@@ -7879,6 +7883,15 @@
299 cc->add_var(catch_clause::err_column_no,
300 bind_var(loc, lColumnNo, var_expr::catch_var, theRTM.INTEGER_TYPE_QUESTION));
301
302+ cc->add_var(catch_clause::zerr_data_uri,
303+ bind_var(loc, lDataURI, var_expr::catch_var, theRTM.STRING_TYPE_QUESTION));
304+
305+ cc->add_var(catch_clause::zerr_data_line_no,
306+ bind_var(loc, lDataLineNo, var_expr::catch_var, theRTM.INTEGER_TYPE_QUESTION));
307+
308+ cc->add_var(catch_clause::zerr_data_column_no,
309+ bind_var(loc, lDataColumnNo, var_expr::catch_var, theRTM.INTEGER_TYPE_QUESTION));
310+
311 cc->add_var(catch_clause::zerr_stack_trace,
312 bind_var(loc, lStackTrace, var_expr::catch_var, theRTM.ITEM_TYPE_QUESTION));
313
314
315=== modified file 'src/diagnostics/diagnostic.cpp'
316--- src/diagnostics/diagnostic.cpp 2013-01-24 05:48:07 +0000
317+++ src/diagnostics/diagnostic.cpp 2013-02-09 01:33:26 +0000
318@@ -176,6 +176,15 @@
319 namespace diagnostic {
320
321 location const location::empty;
322+
323+bool operator==( location const &i, location const &j ) {
324+ return i.file_ == j.file_
325+ && i.line_ == j.line_
326+ && i.column_ == j.column_
327+ && i.line_end_ == j.line_end_
328+ && i.column_end_ == j.column_end_;
329+}
330+
331 parameters const parameters::empty;
332
333 #define case_123456789 \
334
335=== modified file 'src/diagnostics/diagnostic_en.xml'
336--- src/diagnostics/diagnostic_en.xml 2013-02-08 23:40:49 +0000
337+++ src/diagnostics/diagnostic_en.xml 2013-02-09 01:33:26 +0000
338@@ -3470,6 +3470,10 @@
339 <value>valid values are: yes, no, omit</value>
340 </entry>
341
342+ <entry key="InData">
343+ <value>in data</value>
344+ </entry>
345+
346 <entry key="IncompleteKeyInIndexBuild">
347 <value>incomplete key during index build</value>
348 </entry>
349
350=== modified file 'src/diagnostics/pregenerated/dict_en.cpp'
351--- src/diagnostics/pregenerated/dict_en.cpp 2013-02-08 23:40:49 +0000
352+++ src/diagnostics/pregenerated/dict_en.cpp 2013-02-09 01:33:26 +0000
353@@ -637,6 +637,7 @@
354 { "~GoodValuesAreXMLEtc", "valid values are: xml, html, xhtml, text, binary, json, jsoniq" },
355 { "~GoodValuesAreYesNo", "valid values are: yes, no" },
356 { "~GoodValuesAreYesNoOmit", "valid values are: yes, no, omit" },
357+ { "~InData", "in data" },
358 { "~IncompleteKeyInIndexBuild", "incomplete key during index build" },
359 { "~IncompleteKeyInIndexRefresh", "incomplete key during index refresh" },
360 { "~JNDY0021_IllegalCharacter_2", "'$2': illegal JSON character" },
361
362=== modified file 'src/diagnostics/pregenerated/dict_zed_keys.h'
363--- src/diagnostics/pregenerated/dict_zed_keys.h 2013-02-08 22:14:56 +0000
364+++ src/diagnostics/pregenerated/dict_zed_keys.h 2013-02-09 01:33:26 +0000
365@@ -191,6 +191,7 @@
366 #define ZED_GoodValuesAreXMLEtc "~GoodValuesAreXMLEtc"
367 #define ZED_GoodValuesAreYesNo "~GoodValuesAreYesNo"
368 #define ZED_GoodValuesAreYesNoOmit "~GoodValuesAreYesNoOmit"
369+#define ZED_InData "~InData"
370 #define ZED_IncompleteKeyInIndexBuild "~IncompleteKeyInIndexBuild"
371 #define ZED_IncompleteKeyInIndexRefresh "~IncompleteKeyInIndexRefresh"
372 #define ZED_LibModVersionMismatch_3 "~LibModVersionMismatch_3"
373
374=== modified file 'src/diagnostics/xquery_exception.cpp'
375--- src/diagnostics/xquery_exception.cpp 2013-02-07 03:15:48 +0000
376+++ src/diagnostics/xquery_exception.cpp 2013-02-09 01:33:26 +0000
377@@ -58,6 +58,7 @@
378 XQueryException::XQueryException( XQueryException const &from ) :
379 ZorbaException( from ),
380 source_loc_( from.source_loc_ ),
381+ data_loc_( from.data_loc_ ),
382 applied_loc_( from.applied_loc_ ),
383 query_trace_( from.query_trace_ )
384 {
385@@ -84,6 +85,7 @@
386 if ( &from != this ) {
387 ZorbaException::operator=( from );
388 source_loc_ = from.source_loc_;
389+ data_loc_ = from.data_loc_;
390 applied_loc_ = from.applied_loc_;
391 query_trace_ = from.query_trace_;
392 }
393@@ -109,6 +111,16 @@
394 applied_loc_.set( uri, line, col, line_end, col_end );
395 }
396
397+void XQueryException::set_data( char const *uri,
398+ line_type line,
399+ column_type col,
400+ line_type line_end,
401+ column_type col_end ) {
402+ if ( !uri || !*uri )
403+ uri = source_loc_.file();
404+ data_loc_.set( uri, line, col, line_end, col_end );
405+}
406+
407 void XQueryException::set_source( char const *uri,
408 line_type line,
409 column_type col,
410@@ -150,6 +162,16 @@
411 #endif
412 o << "/>" << if_nl; // <location ...
413
414+ if ( has_data() ) {
415+ o << indent << "<data-location";
416+ if ( data_uri() && ::strcmp( data_uri(), source_uri() ) != 0 )
417+ print_uri( o, applied_uri() );
418+ o << " line=\"" << data_line() << '"';
419+ if ( data_column() )
420+ o << " column=\"" << data_column() << '"';
421+ o << "/>" << if_nl; // <data-location ...
422+ }
423+
424 if ( has_applied() ) {
425 o << indent << "<applied-at";
426 if ( applied_uri() && ::strcmp( applied_uri(), source_uri() ) != 0 )
427@@ -172,6 +194,18 @@
428 if ( source_column() )
429 o << "," << source_column();
430
431+ if ( has_data() && data_loc_ != source_loc_ ) {
432+ o << " (" << diagnostic::dict::lookup( ZED( InData ) ) << ' ';
433+ if ( data_uri() && ::strcmp( data_uri(), source_uri() ) != 0 ) {
434+ if ( print_uri( o, data_uri() ) )
435+ o << ':';
436+ }
437+ o << data_line();
438+ if ( data_column() )
439+ o << ',' << data_column();
440+ o << ')';
441+ }
442+
443 if ( has_applied() ) {
444 o << " (" << diagnostic::dict::lookup( ZED( AppliedAt ) ) << ' ';
445 if ( applied_uri() && ::strcmp( applied_uri(), source_uri() ) != 0 ) {
446@@ -341,6 +375,24 @@
447 }
448 }
449
450+void set_data( ZorbaException &ze, char const *file,
451+ XQueryException::line_type line,
452+ XQueryException::column_type col,
453+ XQueryException::line_type line_end,
454+ XQueryException::column_type col_end,
455+ bool overwrite ) {
456+ if ( XQueryException *const xe = dynamic_cast<XQueryException*>( &ze ) ) {
457+ if ( !xe->has_data() || overwrite )
458+ xe->set_data( file, line, col, line_end, col_end );
459+ } else {
460+ XQueryException new_xe(
461+ ze.diagnostic(), ze.raise_file(), ze.raise_line(), ze.what()
462+ );
463+ new_xe.set_data( file, line, col, line_end, col_end );
464+ throw new_xe;
465+ }
466+}
467+
468 void set_source( ZorbaException &ze, char const *file,
469 XQueryException::line_type line,
470 XQueryException::column_type col,
471
472=== modified file 'src/diagnostics/xquery_exception.h'
473--- src/diagnostics/xquery_exception.h 2013-02-05 04:53:32 +0000
474+++ src/diagnostics/xquery_exception.h 2013-02-09 01:33:26 +0000
475@@ -232,6 +232,112 @@
476 }
477 }
478
479+////////// XQuery diagnostic data location ////////////////////////////////////
480+
481+/**
482+ * Sets the data location of the given ZorbaException but only if it's actually
483+ * an XQueryException. If it's actually a ZorbaException, constructs a new
484+ * XQueryException (copying the information from the ZorbaException) and throws
485+ * it.
486+ *
487+ * @param ze The ZorbaException to set the location of.
488+ * @param file The data file name.
489+ * @param line The line number.
490+ * @param col The column number.
491+ * @param line_end The end line number.
492+ * @param col_end The end column number.
493+ * @param overwrite If \c false, sets the location only if the exception
494+ * doesn't already have one; if \c true, always sets the location even if the
495+ * exception already has one.
496+ */
497+void set_data( ZorbaException &ze, char const *file,
498+ XQueryException::line_type line,
499+ XQueryException::column_type col,
500+ XQueryException::line_type line_end,
501+ XQueryException::column_type col_end,
502+ bool overwrite = true );
503+
504+/**
505+ * Sets the data location of the given ZorbaException but only if it's actually
506+ * an XQueryException. If it's actually a ZorbaException, constructs a new
507+ * XQueryException (copying the information from the ZorbaException) and throws
508+ * it.
509+ *
510+ * @tparam StringType The \a file string type.
511+ * @param ze The ZorbaException to set the location of.
512+ * @param file The data file name.
513+ * @param line The line number.
514+ * @param col The column number.
515+ * @param line_end The end line number.
516+ * @param col_end The end column number.
517+ * @param overwrite If \c false, sets the location only if the exception
518+ * doesn't already have one; if \c true, always sets the location even if the
519+ * exception already has one.
520+ */
521+template<class StringType> inline
522+void set_data( ZorbaException &ze, StringType const &file,
523+ XQueryException::line_type line,
524+ XQueryException::column_type col,
525+ XQueryException::line_type line_end,
526+ XQueryException::column_type col_end,
527+ bool overwrite = true ) {
528+ set_data( ze, file.c_str(), line, col, line_end, col_end, overwrite );
529+}
530+
531+/**
532+ * Sets the data location of the given ZorbaException but only if it's actually
533+ * an XQueryException. If it's actually a ZorbaException, constructs a new
534+ * XQueryException (copying the information from the ZorbaException) and throws
535+ * it.
536+ *
537+ * @param ze The ZorbaException to set the location of.
538+ * @param loc The query location.
539+ * @param overwrite If \c false, sets the location only if the exception
540+ * doesn't already have one; if \c true, always sets the location even if the
541+ * exception already has one.
542+ */
543+inline void set_data( ZorbaException &ze, QueryLoc const &loc,
544+ bool overwrite = true ) {
545+ set_data(
546+ ze,
547+ loc.getFilename(),
548+ loc.getLineBegin(),
549+ loc.getColumnBegin(),
550+ loc.getLineEnd(),
551+ loc.getColumnEnd(),
552+ overwrite
553+ );
554+}
555+
556+/**
557+ * Sets the data location of the given ZorbaException but only if it's actually
558+ * an XQueryException. If it's actually a ZorbaException, constructs a new
559+ * XQueryException (copying the information from the ZorbaException) and throws
560+ * it.
561+ *
562+ * @param to The ZorbaException to set the location of.
563+ * @param from The ZorbaException to get the location from but only if it's
564+ * actually an XQueryException.
565+ * @param overwrite If \c false, sets the location only if the exception
566+ * doesn't already have one; if \c true, always sets the location even if the
567+ * exception already has one.
568+ */
569+inline void set_data( ZorbaException &to, ZorbaException const &from,
570+ bool overwrite = true ) {
571+ if ( XQueryException const *const xe =
572+ dynamic_cast<XQueryException const*>( &from ) ) {
573+ set_data(
574+ to,
575+ xe->data_uri(),
576+ xe->data_line(),
577+ xe->data_column(),
578+ xe->data_line_end(),
579+ xe->data_column_end(),
580+ overwrite
581+ );
582+ }
583+}
584+
585 ////////// XQuery diagnostic "applied at" location ////////////////////////////
586
587 /**
588
589=== modified file 'src/runtime/core/trycatch.cpp'
590--- src/runtime/core/trycatch.cpp 2012-10-08 12:09:36 +0000
591+++ src/runtime/core/trycatch.cpp 2013-02-09 01:33:26 +0000
592@@ -498,6 +498,94 @@
593 }
594 break;
595 }
596+
597+ case CatchClause::zerr_data_uri:
598+ {
599+ LetVarConstIter lErrorDataURIVarIter = lIter->second.begin();
600+ LetVarConstIter const lErrorDataURIVarIterEnd = lIter->second.end();
601+
602+ for ( ; lErrorDataURIVarIter != lErrorDataURIVarIterEnd;
603+ ++lErrorDataURIVarIter )
604+ {
605+ store::Iterator_t lErrorDataURIIter;
606+
607+ XQueryException const *const xe =
608+ dynamic_cast<XQueryException const*>( &e );
609+ if ( xe && xe->has_data() ) {
610+ store::Item_t lErrorDataURIItem;
611+ zstring uri( xe->data_uri() );
612+ GENV_ITEMFACTORY->createString( lErrorDataURIItem, uri );
613+ lErrorDataURIIter = new ItemIterator(lErrorDataURIItem);
614+ }
615+ else
616+ {
617+ lErrorDataURIIter = new ItemIterator();
618+ }
619+ lErrorDataURIIter->open();
620+ state->theErrorIters.push_back(lErrorDataURIIter);
621+ (*lErrorDataURIVarIter)->bind(lErrorDataURIIter, planState);
622+ }
623+ break;
624+ }
625+
626+ case CatchClause::zerr_data_line_no:
627+ {
628+ LetVarConstIter lErrorDataLineVarIter = lIter->second.begin();
629+ LetVarConstIter const lErrorDataLineVarIterEnd = lIter->second.end();
630+
631+ for ( ; lErrorDataLineVarIter != lErrorDataLineVarIterEnd;
632+ ++lErrorDataLineVarIter )
633+ {
634+ store::Iterator_t lErrorDataLineIter;
635+
636+ XQueryException const *const xe =
637+ dynamic_cast<XQueryException const*>( &e );
638+ if ( xe && xe->has_data() ) {
639+ store::Item_t lErrorDataLineItem;
640+ GENV_ITEMFACTORY->createInteger(
641+ lErrorDataLineItem, xs_integer(xe->data_line()));
642+ lErrorDataLineIter = new ItemIterator(lErrorDataLineItem);
643+ }
644+ else
645+ {
646+ lErrorDataLineIter = new ItemIterator();
647+ }
648+ lErrorDataLineIter->open();
649+ state->theErrorIters.push_back(lErrorDataLineIter);
650+ (*lErrorDataLineVarIter)->bind(lErrorDataLineIter, planState);
651+ }
652+ break;
653+ }
654+
655+ case CatchClause::zerr_data_column_no:
656+ {
657+ LetVarConstIter lErrorDataColumnVarIter = lIter->second.begin();
658+ LetVarConstIter const lErrorDataColumnVarIterEnd = lIter->second.end();
659+
660+ for ( ; lErrorDataColumnVarIter != lErrorDataColumnVarIterEnd;
661+ ++lErrorDataColumnVarIter )
662+ {
663+ store::Iterator_t lErrorDataColumnIter;
664+
665+ XQueryException const *const xe =
666+ dynamic_cast<XQueryException const*>( &e );
667+ if ( xe && xe->has_data() ) {
668+ store::Item_t lErrorDataColumnItem;
669+ GENV_ITEMFACTORY->createInteger(
670+ lErrorDataColumnItem, xs_integer(xe->data_column()));
671+ lErrorDataColumnIter = new ItemIterator(lErrorDataColumnItem);
672+ }
673+ else
674+ {
675+ lErrorDataColumnIter = new ItemIterator();
676+ }
677+ lErrorDataColumnIter->open();
678+ state->theErrorIters.push_back(lErrorDataColumnIter);
679+ (*lErrorDataColumnVarIter)->bind(lErrorDataColumnIter, planState);
680+ }
681+ break;
682+ }
683+
684 case CatchClause::zerr_stack_trace:
685 {
686 LetVarConstIter lStackTraceVarIter = lIter->second.begin();
687
688=== modified file 'src/runtime/core/trycatch.h'
689--- src/runtime/core/trycatch.h 2012-09-19 21:16:15 +0000
690+++ src/runtime/core/trycatch.h 2013-02-09 01:33:26 +0000
691@@ -61,6 +61,9 @@
692 err_module,
693 err_line_no,
694 err_column_no,
695+ zerr_data_uri,
696+ zerr_data_line_no,
697+ zerr_data_column_no,
698 zerr_stack_trace
699 };
700
701
702=== modified file 'src/runtime/json/common.cpp'
703--- src/runtime/json/common.cpp 2011-12-28 05:41:00 +0000
704+++ src/runtime/json/common.cpp 2013-02-09 01:33:26 +0000
705@@ -15,7 +15,10 @@
706 */
707 #include "stdafx.h"
708
709+#include <zorba/xquery_exception.h>
710+
711 #include "store/api/iterator.h"
712+#include "util/json_parser.h"
713
714 #include "common.h"
715
716@@ -42,6 +45,13 @@
717 return found;
718 }
719
720+void set_data( XQueryException *xe, json::exception const &je ) {
721+ json::location const &loc( je.get_loc() );
722+ xe->set_data(
723+ loc.file(), loc.line(), loc.column(), loc.line_end(), loc.column_end()
724+ );
725+}
726+
727 ///////////////////////////////////////////////////////////////////////////////
728
729 #if ZORBA_DEBUG_JSON
730
731=== modified file 'src/runtime/json/common.h'
732--- src/runtime/json/common.h 2013-02-01 06:03:17 +0000
733+++ src/runtime/json/common.h 2013-02-09 01:33:26 +0000
734@@ -30,6 +30,9 @@
735
736 namespace zorba {
737
738+class XQueryException;
739+namespace json { class exception; }
740+
741 ///////////////////////////////////////////////////////////////////////////////
742
743 typedef std::stack<store::Item*> item_stack_type;
744@@ -56,6 +59,10 @@
745 bool get_attribute_value( store::Item_t const &element, char const *att_name,
746 zstring *att_value );
747
748+void set_data( XQueryException*, json::exception const& );
749+
750+typedef std::ostream& (*std_omanip_type)(std::ostream&);
751+
752 ///////////////////////////////////////////////////////////////////////////////
753
754 #define IN_STATE(S) ztd::top_stack_equals( state_stack, (S) )
755
756=== modified file 'src/runtime/json/json_impl.cpp'
757--- src/runtime/json/json_impl.cpp 2012-11-29 05:00:43 +0000
758+++ src/runtime/json/json_impl.cpp 2013-02-09 01:33:26 +0000
759@@ -103,50 +103,78 @@
760 ZORBA_ASSERT( false );
761 }
762 catch ( json::illegal_character const &e ) {
763- throw XQUERY_EXCEPTION(
764- zerr::ZJPE0001_ILLEGAL_CHARACTER,
765- ERROR_PARAMS( ascii::printable_char( e.get_char() ) ),
766- ERROR_LOC( e.get_loc() )
767+ XQueryException xe(
768+ XQUERY_EXCEPTION(
769+ zerr::ZJPE0001_ILLEGAL_CHARACTER,
770+ ERROR_PARAMS( ascii::printable_char( e.get_char() ) ),
771+ ERROR_LOC( e.get_loc() )
772+ )
773 );
774+ set_data( &xe, e );
775+ throw xe;
776 }
777 catch ( json::illegal_codepoint const &e ) {
778- throw XQUERY_EXCEPTION(
779- zerr::ZJPE0002_ILLEGAL_CODEPOINT,
780- ERROR_PARAMS( e.get_codepoint() ),
781- ERROR_LOC( e.get_loc() )
782+ XQueryException xe(
783+ XQUERY_EXCEPTION(
784+ zerr::ZJPE0002_ILLEGAL_CODEPOINT,
785+ ERROR_PARAMS( e.get_codepoint() ),
786+ ERROR_LOC( e.get_loc() )
787+ )
788 );
789+ set_data( &xe, e );
790+ throw xe;
791 }
792 catch ( json::illegal_escape const &e ) {
793- throw XQUERY_EXCEPTION(
794- zerr::ZJPE0003_ILLEGAL_ESCAPE,
795- ERROR_PARAMS( e.get_escape() ),
796- ERROR_LOC( e.get_loc() )
797+ XQueryException xe(
798+ XQUERY_EXCEPTION(
799+ zerr::ZJPE0003_ILLEGAL_ESCAPE,
800+ ERROR_PARAMS( e.get_escape() ),
801+ ERROR_LOC( e.get_loc() )
802+ )
803 );
804+ set_data( &xe, e );
805+ throw xe;
806 }
807 catch ( json::illegal_literal const &e ) {
808- throw XQUERY_EXCEPTION(
809- zerr::ZJPE0004_ILLEGAL_LITERAL,
810- ERROR_LOC( e.get_loc() )
811+ XQueryException xe(
812+ XQUERY_EXCEPTION(
813+ zerr::ZJPE0004_ILLEGAL_LITERAL,
814+ ERROR_LOC( e.get_loc() )
815+ )
816 );
817+ set_data( &xe, e );
818+ throw xe;
819 }
820 catch ( json::illegal_number const &e ) {
821- throw XQUERY_EXCEPTION(
822- zerr::ZJPE0005_ILLEGAL_NUMBER,
823- ERROR_LOC( e.get_loc() )
824+ XQueryException xe(
825+ XQUERY_EXCEPTION(
826+ zerr::ZJPE0005_ILLEGAL_NUMBER,
827+ ERROR_LOC( e.get_loc() )
828+ )
829 );
830+ set_data( &xe, e );
831+ throw xe;
832 }
833 catch ( json::unexpected_token const &e ) {
834- throw XQUERY_EXCEPTION(
835- zerr::ZJPE0006_UNEXPECTED_TOKEN,
836- ERROR_PARAMS( e.get_token() ),
837- ERROR_LOC( e.get_loc() )
838+ XQueryException xe(
839+ XQUERY_EXCEPTION(
840+ zerr::ZJPE0006_UNEXPECTED_TOKEN,
841+ ERROR_PARAMS( e.get_token() ),
842+ ERROR_LOC( e.get_loc() )
843+ )
844 );
845+ set_data( &xe, e );
846+ throw xe;
847 }
848 catch ( json::unterminated_string const &e ) {
849- throw XQUERY_EXCEPTION(
850- zerr::ZJPE0007_UNTERMINATED_STRING,
851- ERROR_LOC( e.get_loc() )
852+ XQueryException xe(
853+ XQUERY_EXCEPTION(
854+ zerr::ZJPE0007_UNTERMINATED_STRING,
855+ ERROR_LOC( e.get_loc() )
856+ )
857 );
858+ set_data( &xe, e );
859+ throw xe;
860 }
861
862 STACK_PUSH( !!result, state );
863
864=== modified file 'src/runtime/json/json_loader.cpp'
865--- src/runtime/json/json_loader.cpp 2012-12-03 18:29:05 +0000
866+++ src/runtime/json/json_loader.cpp 2013-02-09 01:33:26 +0000
867@@ -31,6 +31,7 @@
868 #include "zorbatypes/zstring.h"
869
870 // local
871+#include "common.h"
872 #include "json_loader.h"
873
874 using namespace std;
875@@ -206,65 +207,93 @@
876 return false;
877 } // try
878 catch ( json::illegal_character const &e ) {
879- throw XQUERY_EXCEPTION(
880- jerr::JNDY0021,
881- ERROR_PARAMS(
882- ZED( JNDY0021_IllegalCharacter_2 ),
883- ascii::printable_char( e.get_char() )
884- ),
885- ERROR_LOC( e.get_loc() )
886+ XQueryException xe(
887+ XQUERY_EXCEPTION(
888+ jerr::JNDY0021,
889+ ERROR_PARAMS(
890+ ZED( JNDY0021_IllegalCharacter_2 ),
891+ ascii::printable_char( e.get_char() )
892+ ),
893+ ERROR_LOC( e.get_loc() )
894+ )
895 );
896+ set_data( &xe, e );
897+ throw xe;
898 }
899 catch ( json::illegal_codepoint const &e ) {
900- throw XQUERY_EXCEPTION(
901- jerr::JNDY0021,
902- ERROR_PARAMS(
903- ZED( JNDY0021_IllegalCodepoint_2 ),
904- e.get_codepoint()
905- ),
906- ERROR_LOC( e.get_loc() )
907+ XQueryException xe(
908+ XQUERY_EXCEPTION(
909+ jerr::JNDY0021,
910+ ERROR_PARAMS(
911+ ZED( JNDY0021_IllegalCodepoint_2 ),
912+ e.get_codepoint()
913+ ),
914+ ERROR_LOC( e.get_loc() )
915+ )
916 );
917+ set_data( &xe, e );
918+ throw xe;
919 }
920 catch ( json::illegal_escape const &e ) {
921- throw XQUERY_EXCEPTION(
922- jerr::JNDY0021,
923- ERROR_PARAMS(
924- ZED( JNDY0021_IllegalEscape_2 ),
925- ascii::printable_char( e.get_escape() )
926- ),
927- ERROR_LOC( e.get_loc() )
928+ XQueryException xe(
929+ XQUERY_EXCEPTION(
930+ jerr::JNDY0021,
931+ ERROR_PARAMS(
932+ ZED( JNDY0021_IllegalEscape_2 ),
933+ ascii::printable_char( e.get_escape() )
934+ ),
935+ ERROR_LOC( e.get_loc() )
936+ )
937 );
938+ set_data( &xe, e );
939+ throw xe;
940 }
941 catch ( json::illegal_literal const &e ) {
942- throw XQUERY_EXCEPTION(
943- jerr::JNDY0021,
944- ERROR_PARAMS( ZED( JNDY0021_IllegalLiteral ) ),
945- ERROR_LOC( e.get_loc() )
946+ XQueryException xe(
947+ XQUERY_EXCEPTION(
948+ jerr::JNDY0021,
949+ ERROR_PARAMS( ZED( JNDY0021_IllegalLiteral ) ),
950+ ERROR_LOC( e.get_loc() )
951+ )
952 );
953+ set_data( &xe, e );
954+ throw xe;
955 }
956 catch ( json::illegal_number const &e ) {
957- throw XQUERY_EXCEPTION(
958- jerr::JNDY0021,
959- ERROR_PARAMS( ZED( JNDY0021_IllegalNumber ) ),
960- ERROR_LOC( e.get_loc() )
961+ XQueryException xe(
962+ XQUERY_EXCEPTION(
963+ jerr::JNDY0021,
964+ ERROR_PARAMS( ZED( JNDY0021_IllegalNumber ) ),
965+ ERROR_LOC( e.get_loc() )
966+ )
967 );
968+ set_data( &xe, e );
969+ throw xe;
970 }
971 catch ( json::unexpected_token const &e ) {
972- throw XQUERY_EXCEPTION(
973- jerr::JNDY0021,
974- ERROR_PARAMS(
975- ZED( JNDY0021_UnexpectedToken_2 ),
976- e.get_token()
977- ),
978- ERROR_LOC( e.get_loc() )
979+ XQueryException xe(
980+ XQUERY_EXCEPTION(
981+ jerr::JNDY0021,
982+ ERROR_PARAMS(
983+ ZED( JNDY0021_UnexpectedToken_2 ),
984+ e.get_token()
985+ ),
986+ ERROR_LOC( e.get_loc() )
987+ )
988 );
989+ set_data( &xe, e );
990+ throw xe;
991 }
992 catch ( json::unterminated_string const &e ) {
993- throw XQUERY_EXCEPTION(
994- jerr::JNDY0021,
995- ERROR_PARAMS( ZED( JNDY0021_UnterminatedString ) ),
996- ERROR_LOC( e.get_loc() )
997+ XQueryException xe(
998+ XQUERY_EXCEPTION(
999+ jerr::JNDY0021,
1000+ ERROR_PARAMS( ZED( JNDY0021_UnterminatedString ) ),
1001+ ERROR_LOC( e.get_loc() )
1002+ )
1003 );
1004+ set_data( &xe, e );
1005+ throw xe;
1006 }
1007 }
1008
1009
1010=== modified file 'src/store/naive/loader_fast.cpp'
1011--- src/store/naive/loader_fast.cpp 2013-01-21 03:22:59 +0000
1012+++ src/store/naive/loader_fast.cpp 2013-02-09 01:33:26 +0000
1013@@ -145,30 +145,32 @@
1014 XmlLoader *const loader = static_cast<XmlLoader*>( ctx );
1015 switch ( error->level ) {
1016 case XML_ERR_ERROR:
1017- case XML_ERR_FATAL:
1018- loader->theXQueryDiagnostics->add_error(
1019- NEW_XQUERY_EXCEPTION(
1020- zerr::ZSTR0021_LOADER_PARSING_ERROR,
1021- ERROR_PARAMS(
1022- error->file, error->line, error->int2 /* column */,
1023- libxml_dict_key_4, error_str1_5, error_str2_6, error_str3_7,
1024- error_int1_8, error_message_9
1025- )
1026- )
1027- );
1028- break;
1029- case XML_ERR_WARNING:
1030- loader->theXQueryDiagnostics->add_warning(
1031- NEW_XQUERY_WARNING(
1032- zwarn::ZWST0007_LOADER_PARSING_WARNING,
1033- WARN_PARAMS(
1034- error->file, error->line, error->int2 /* column */,
1035- libxml_dict_key_4, error_str1_5, error_str2_6, error_str3_7,
1036- error_int1_8, error_message_9
1037- )
1038- )
1039- );
1040- break;
1041+ case XML_ERR_FATAL: {
1042+ XQueryException *const xe = NEW_XQUERY_EXCEPTION(
1043+ zerr::ZSTR0021_LOADER_PARSING_ERROR,
1044+ ERROR_PARAMS(
1045+ error->file, error->line, error->int2 /* column */,
1046+ libxml_dict_key_4, error_str1_5, error_str2_6, error_str3_7,
1047+ error_int1_8, error_message_9
1048+ )
1049+ );
1050+ xe->set_data( error->file, error->line, error->int2 /* column */ );
1051+ loader->theXQueryDiagnostics->add_error( xe );
1052+ break;
1053+ }
1054+ case XML_ERR_WARNING: {
1055+ XQueryWarning *const xw = NEW_XQUERY_WARNING(
1056+ zwarn::ZWST0007_LOADER_PARSING_WARNING,
1057+ WARN_PARAMS(
1058+ error->file, error->line, error->int2 /* column */,
1059+ libxml_dict_key_4, error_str1_5, error_str2_6, error_str3_7,
1060+ error_int1_8, error_message_9
1061+ )
1062+ );
1063+ xw->set_data( error->file, error->line, error->int2 /* column */ );
1064+ loader->theXQueryDiagnostics->add_warning( xw );
1065+ break;
1066+ }
1067 default:
1068 ZORBA_ASSERT( false );
1069 } // switch
1070
1071=== added file 'test/rbkt/ExpQueryResults/zorba/error/data-location-json-1.xml.res'
1072--- test/rbkt/ExpQueryResults/zorba/error/data-location-json-1.xml.res 1970-01-01 00:00:00 +0000
1073+++ test/rbkt/ExpQueryResults/zorba/error/data-location-json-1.xml.res 2013-02-09 01:33:26 +0000
1074@@ -0,0 +1,1 @@
1075+. 3 1
1076
1077=== added file 'test/rbkt/ExpQueryResults/zorba/error/data-location-xml-1.xml.res'
1078--- test/rbkt/ExpQueryResults/zorba/error/data-location-xml-1.xml.res 1970-01-01 00:00:00 +0000
1079+++ test/rbkt/ExpQueryResults/zorba/error/data-location-xml-1.xml.res 2013-02-09 01:33:26 +0000
1080@@ -0,0 +1,1 @@
1081+data-location.xml 3 1
1082
1083=== added file 'test/rbkt/Queries/zorba/error/data-location-json-1.xq'
1084--- test/rbkt/Queries/zorba/error/data-location-json-1.xq 1970-01-01 00:00:00 +0000
1085+++ test/rbkt/Queries/zorba/error/data-location-json-1.xq 2013-02-09 01:33:26 +0000
1086@@ -0,0 +1,23 @@
1087+import module namespace file = "http://expath.org/ns/file";
1088+import module namespace jn = "http://jsoniq.org/functions";
1089+declare namespace zerr = "http://www.zorba-xquery.com/errors";
1090+
1091+let $file := "$RBKT_SRC_DIR/Queries/zorba/error/data-location.json"
1092+let $json := file:read-text( $file )
1093+return
1094+ try {
1095+ jn:parse-json( $json )
1096+ }
1097+ catch * {
1098+ (:
1099+ : This "if" is here temporarily until streamable strings have their
1100+ : filenames passed along with them.
1101+ :)
1102+ if ( exists( $zerr:data-uri ) )
1103+ then file:base-name( $zerr:data-uri )
1104+ else (),
1105+ $zerr:data-line-number,
1106+ $zerr:data-column-number
1107+ }
1108+
1109+(: vim:set et sw=2 ts=2: :)
1110
1111=== added file 'test/rbkt/Queries/zorba/error/data-location-xml-1.xq'
1112--- test/rbkt/Queries/zorba/error/data-location-xml-1.xq 1970-01-01 00:00:00 +0000
1113+++ test/rbkt/Queries/zorba/error/data-location-xml-1.xq 2013-02-09 01:33:26 +0000
1114@@ -0,0 +1,13 @@
1115+import module namespace file = "http://expath.org/ns/file";
1116+declare namespace zerr = "http://www.zorba-xquery.com/errors";
1117+
1118+try {
1119+ fn:doc( "data-location.xml" )
1120+}
1121+catch * {
1122+ file:base-name( $zerr:data-uri ),
1123+ $zerr:data-line-number,
1124+ $zerr:data-column-number
1125+}
1126+
1127+(: vim:set et sw=2 ts=2: :)
1128
1129=== added file 'test/rbkt/Queries/zorba/error/data-location.json'
1130--- test/rbkt/Queries/zorba/error/data-location.json 1970-01-01 00:00:00 +0000
1131+++ test/rbkt/Queries/zorba/error/data-location.json 2013-02-09 01:33:26 +0000
1132@@ -0,0 +1,3 @@
1133+{
1134+ "key" : 42,
1135+}
1136
1137=== added file 'test/rbkt/Queries/zorba/error/data-location.xml'
1138--- test/rbkt/Queries/zorba/error/data-location.xml 1970-01-01 00:00:00 +0000
1139+++ test/rbkt/Queries/zorba/error/data-location.xml 2013-02-09 01:33:26 +0000
1140@@ -0,0 +1,2 @@
1141+<!-- terminating '>' is intentionally missing -->
1142+<msg>hello, world!</msg

Subscribers

People subscribed via source and target branches