eliom
eliom copied to clipboard
Problem with 1st tutorial example
Eliom 6.0, Ocaml 4.03.0+Flambda
I tried to do the tutorial example here. When running make test.byte, I get the following error:
ocsigenserver: ocsigen:main: Fatal - Error in configuration file: Error while parsing configuration file: Eliom: while loading local/lib/mysite/mysite.cma: Eliom: Duplicate registration of service "aaa/bbb". Please correct the module.
Any idea what's wrong? There's no obvious duplication anywhere, and I only modified the example as told to in the tutorial.
That's strange. Could you test on a non-Flambda switch? It should work fine there.
If the problem is related to Flambda, we would need to investigate what happens twice. I have no idea what could be going on.
Just tested on 4.04.0, non-Flambda. Same problem.
I can't reproduce. Please provide the complete code that you are running.
OK I must be doing something stupid then.
Following the example, after using eliom-distillery, I edit the mysite.eliom file to be as in this gist. What am I doing wrong?
Your Eliom_registration.Html_text.create call registers the service automatically, and your Mysite_app.register call tries to register it a second time.
You were supposed to replace the contents of mysite.eliom with the provided code, not mix the two.
@vasilisp Would there be a way to provide a backtrace and/or location information for this kind of issues ?
My bad. Though to be fair, the creation of main_service makes it seem like it should fit in with the remainder of the code from the distillery, which uses main_service. Also, the tutorial states to "Modify file mysite.eliom to include the piece of code above, instead of the default one", which I took to mean combination with existing code.
@bluddy, we need to rephrase the instead of the default one part, I understand how one would get confused.
@Drup, it sounds feasible. We could store the registration locations (obtained via ppx_here, for example) into the routing data structures, and show them when complaining about duplicate registration.
@vasilisp: If we go that way, no need for a ppx, __LOC__ is more than enough. But I would prefer to avoid involving the user.
Why not just raise an exception and show the backtraces by default in the logs ?
There is an exception already, and we could show a backtrace during the second register. I don't know how much that would help new users; they would have to spot their own calls somewhere low in the stack.
I remember using here in the 4.01 days, and never noticed the new __LOC__ thing :).
I think both a backtrace and a location would really help new users (such as myself).