Hi devs,

I was playing with the office preview script service when I discovered 
that $services throws ScriptServiceNotFoundException when there's no 
script service registered for the specified hint, e.g. $services.foo . I 
was expecting $services to return null when it fails to locate a 
service. I even wrote:

#if($services.officepreview)
   {{html}}
   $services.officepreview.preview(...)
   {{/html}}
#else
   {{error}}The office preview component has not been installed.{{/error}}
#end

What do you think it's best: to throw ScriptServiceNotFoundException or 
to return null?

Anyway, I think there should be a method to check if a script service is 
available ( 
http://svn.xwiki.org/svnroot/xwiki/platform/core/trunk/xwiki-script/src/main/java/org/xwiki/script/service/ScriptServiceManager.java
 
).

WDYT?

Thanks,
Marius
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to