Hi,
For many reasons, we often encounter this pattern:
1) A process runs that tries to update the same .xml file twice within a
single updating function. Or a writer may save a file or import a file from
translation that is not well formed.
Result: the .xml file is now saved as a raw file.
2) A second process (or the same process) tries to update that file
again.
Result: Improper user? Potential big? issue.
Because we can't seem to catch the error on the 1st run (or maybe I'm
trying the wrong way?), we might carry for a while without knowing that an
issue occured. Then we get the second message, which is not very helpful
because it doesn't help us catch the issue that caused the error.
Would it be possible to improve the error handling on this issue, mostly to
catch it on step 1?
Here is a small test function to replicate the scenario.
First call it with $x !='C'
Then, change the test condition to $x = 'C' and call it again for the
improper use error.
*declare* %rest:path('tests/tries2')
%rest:GET
%output:method('html')
%output:html-version('5.0')
*updating* *function* *tries:controller2*(){
*try* {
*for **$x* *in *('A', 'B', 'C')
*return if* (*$x* != 'C')
*then **db:replace*('en-us', 'test-updates.xml', <div>Hi!</div>
)
*else *()
} *catch* *** {
(: This does not catch the issue in db:replace for a double update on
the same file :)
*db:replace*('en-us', 'errors.xml',
<div *style*=*"color:red;"*>
<h1>Error</h1>
<p>{*$err:code*}: {*$err:description*}</p>
<div>{*$err:value*}</div>
</div>)
}
};
Regards,
France
--
France Baril
Architecte documentaire / Documentation architect
france.baril(a)architextus.com