-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cider-uruk-any should be more helpful with errors #13
Comments
If Is it what are you looking for? |
Exactly, the error location in the XQuery evaluator stack trace is accurate and currently, I'm locating the error manually by looking at the |
In the branch
xquery version "1.0-ml";
module namespace hello = "helloworld";
declare function helloworld()
{
<foo>
};
Now things becomes more interesting when we speak about errors inside documents uploaded to the MarkLogic server. For example syntax error can be placed inside module on the other server. In my installation I store xquery modules in the Now we open another xquery file localy
xquery version "1.0-ml";
import module namespace hw="helloworld" at "/e/test.xqy";
hw:helloworld()
Please give it a try and let me know if any this is missing in this feature. |
Hi, this starts to look nice! For now, there seem to be some problems.
But all together, this look promising. Good work! Maybe make the messages more readable by moving less interesting information down. Have a look at:
The interesting part only starts after "XQueryException com.marklogic.xcc.exceptions.XQueryException: ", and the [Session...][Client...] lines cold be moved below the error message itself, right? Bye, |
Hi! First of all I want to describe how it was implemented. We have We show error buffer in any case without additional preprocessing. Then if there is lines like Pretty simple, right? Now let me explain each item in your list:
2.1. Please, submit reproducible document if possible. You can skip it minimization.
3.1. I don't think we need to move xdbc logic into cider-any-uruk. At least until we finish this branch. Finally on error content modification. I think if we would modify it, we must do it in the clojure layer, when exception object is accessible. Not in Emacs Lisp when it only a string with new lines. I'll try to figure out if it possible based on current uruk code base. Regards, Artem. |
Hello guys, I'm stuck :( Expected usageI'm trying to implement content access for MarkLogic modules. While navigate in the error buffer I want to see the actual position in the module, which triggers error. For example we have this file: xquery version "1.0-ml";
import module namespace sec="http://marklogic.com/xdmp/security" at "/MarkLogic/security.xqy";
sec:user-get-roles("Jim") Now I type
We see three frames of traceback for this error. The first one stays in the xdmp:document-get("/opt/MarkLogic/Modules/MarkLogic/security.xqy") But how do I know this full path to the module? I try to google this solution for two days with out any success... Then when I call After next call to All this thing is working except I can't figure out how to obtain module content from module uri. Modules database settingAlso there are two possible scenarios according to "modules database" setting. It is related to modules which were uploaded ourselves. If we set "modules database" setting to the "(file system)", our modules will be loaded from file system root. To resolve those modules we need something like if (xdmp:modules-database() = 0)
then
xdmp:document-get(fn:concat(xdmp:modules-root(), "/MarkLogic/security.xqy"))
else
... But in general "modules database" setting will be set to something like "Modules" so our modules will be uploaded to this database too. I've tried to do something like this: declare variable $module :=
<module>
<uri>/MarkLogic/security.xqy</uri>
</module>;
let $mdb := xdmp:modules-database()
xdmp:eval(fn:concat('xdmp:document-get("', $module/uri, '")'),
(),
<options xmlns="xdmp:eval">
<database>{$mdb}</database>
</options>) But it doesn't do what I expect. Any suggestions? Regards, Artem. |
Hi Artem, Short answer: the Modules of the Marklogic installation itself are special. Try with a user Module that you've added yourself; it should work for that case. Please have another look at how MarkLogic resolves paths on module loading:
The problem now are:
My perspective on priorities:
Cheers, |
PS: |
As we say in Russia:
I've spent yet another two days trying to import a module from the modules database :( I've tried every possible combination of xdmp:document-insert, xdmp:document-load, xdmp:permission. I just can't create importable module for my test purposes. It will be very nice if you can write short instruction for dummies how to create importable module, how to upload it in to modules database, how to import it. On progressI introduced configurable variable for MarkLogic installation path. By default its value is "/opt/MarkLogic/". I need to note that Windows support will require slightly more efforts to implement. Now when we navigates through error list for each module uri we tries:
I need to test last condition, by I failed to build necessary environment for it. Regards, Artem. |
Hi Artem, Thanks that sounds quite. I'll make you a test example later. No worries, sometimes things behave strangely. Also I will give you feedback about the possible renaming etc. Cheers Max |
Hi, here is a complete example. A module: XQuery code to upload to MarkLogic when talking directly to the Modules database: XQuery code to upload to MarkLogic when talking directly to another database database: XQuery code to show the module when talking directly to the Modules database: XQuery code to show the module when talking to antother database: In general: Better not use Hope that helps, |
I've followed your recommendations and it looks like it finally works. Thanks!! Please check that it works in your environment too. I still can't reproduce the case with empty error buffer. Maybe you will find those circumstances later. NOTE: you should use |
Thank you! That sounds great. Currently, I'm very busy with a project and cannot change the tooling right now. But I noticed your code changes and I'm eager to use it. Thanks for already making the oook-selector repository and updating the code! Oh, could you post screenshot of the error-buffer output? Did you rearrange the output a bit as suggested at the end of my comment in #13 (comment)? By the way, for said project I use all these facilities. Nice to use, also when talking to several MarkLogic instances at the same time. And also some queries are not only more convenient to do from Emacs than MarkLogic's Query Console but also some huge queries I get in below a second of response time while the Query Console takes 4-7 seconds. Isn't that nice? (I'm guessing that the Javascript does some post-processing for nice presentation that takes longer.) Cheers, |
Not yet, but I found the way which can probably work out. If this research will be successful we will have new output format soon. By the way I'm glad you're like it! |
Good morning! I rearrange the output as suggested at the end of your comment. Basically I reimplement exception representation from scratch in the clojure handler. It supersedes this and that methods. Please test if it works for you and if it fits necessary information layout. P.S. my clojure skills are weak so catch code looks not so good. |
Very nice! I just have started to use it, so didn't have an in-depth look. So far very nice! Is there a key to show also the full Java stack trace? Just in case... Cheers, Max |
Yes, it's possible. I will add it at the end of buffer. |
Right now, all exceptions are just printed using the standard cider exception handler:
It would be nice if the XQuery stacktrace was displayed instead. and if there was an easy way to navigate to the XQuery error location from there.
The text was updated successfully, but these errors were encountered: