00652: Add capability to display error message when an include fails
THIS IS FIXED - See section "Displaying Error Messages" on pmwiki page IncludeOtherPages
Description: Add capability to display error message when an include fails.
Some error message like:
Include failure: "(:include PageName:)" check to see if the page exists and that you have the proper access/password to it.
Admins could turn this on in the local/config.php
file.
# set $DisplayIncludeErrors to 'on' if you want
# an error message displayed when an include fails
# default value is "off"
#$DisplayIncludeErrors='on';
A writer would benefit from knowing that an include is failing and would have great difficulty diagnosing this without an error message. This makes it easier for a writer to maintain a more robust web page in accordance to PmWiki philosophy # 4. Support collaborative maintenance of public web pages, and # 5. Be easy to install, configure, and maintain.
Comments
I see some value in being able to do this for my pmwiki-based desktop application that writes contracts for clients. I use and a missing page could be a missing section of my contract, which could be very very bad. Even though I read every contract before it ships, I might not notice a missing section. While I don't have any other personal sites where it would be so vital, when it is needed, it's probably very important. XES June 17, 2007, at 09:56 AM
Or perhaps allow (:include PageName errormsg="some message or PTV" :) Simon
An error message is somewhat surprising to a reader, but less misleading than silence with no indication that something should be there. Note to self: until this is working, write pages so it is obvious if an include isn't included. Fancy coloured icing on the cake: email somebody (who?) if this error is triggered.
(:include PageName Site.IncludeFailed :)
where the Site.IncludeFailed page contains the error message. --Petko August 25, 2009, at 12:22 AM
A "failed include" is not clearly defined. It could be
- no such page(s)
- page exists, but empty
- page exists, but no such section
- page and section exist, but section empty
- page exists, but no such line/para number (like
para=10..
but only 5 paragraphs) - page exists, but visitor has no read permissions
So, which one should trigger the error message? --Petko August 25, 2009, at 12:43 AM
I think ALL the above error conditions belong in the error message. Perhaps you could have an option for a short/long error message. Short would just say 'include error', Long would give all the details. You might also have an option to make an empty page/section be or not be an error. There might be cases where an empty section would be OK and others where it might not be.
Instead of making this a config setting maybe it could be inside the include directive as a parameter. Like adding
--GNUZoo August 29, 2009