Ticket #200 (assigned enhancement)

Opened 2 years ago

Last modified 1 year ago

Plugin object access for error/exception plugins

Reported by: barneyb Owned by: scorfield
Type: enhancement Priority: normal
Milestone: Fusebox 5.6 Component: Miscellaneous
Version: 5.1 Severity: normal
Keywords: Cc:

Description

Currently there is no way to access the "this plugin" information in fuseactionException or processError plugin. From Sean in a thread on the fb5 mailing list:

I'll see if I can figure out a way to at least make the plugin name available... Perhaps inserting the following code into the file contents immediately after every <cfcatch..>

  <cfset myFusebox.thisExceptionPhase = {phaseName} />
  <cfset myFusebox.thisExceptionPlugin = {pluginName} />

Some care should probably be considered for nested cfcatch blocks (i.e. a cftry..cfcatch inside one of the top-level cfcatches), but that's probably rare enough to just document it and say "don't do that, use an include".

Attachments

Change History

Changed 2 years ago by barneyb

Another solution would be to declare the exception type(s) that you care about in fusebox.xml, so the plugins can be included like the other phases:

 <plugin name="myPlugin" template="tmpl.cfm" types="MyException,MyOtherException" />

and then instead of textually including the tmpl.cfm file into the parse file, the cores would write out this code (paraphrased) into the parse file

<cfcatch type="MyException">
  ... context mumbo-jumbo ...
  <cfinclude template="../plugins/tmpl.cfm" />
</cfcatch>
<cfcatch type="MyOtherException">
  ... context mumbo-jumbo ...
  <cfinclude template="../plugins/tmpl.cfm" />
</cfcatch>

That would move the onus of environmental awareness back up to the cores (where it belongs), and let plugins behave as themselves, regardless of type. If a plugin declaration for fuseactionException or processError was missing the types attribute, it'd be considered a FB4-style plugin, and be textually included. That wa we'd preserve backwards compatibility.

Changed 2 years ago by scorfield

  • owner changed from sean@corfield.org to scorfield
  • status changed from new to assigned
  • version set to 5.1
  • milestone set to Fusebox 6.0

Changed 1 year ago by scorfield

I like Barney's suggestion better than my p.o.c. (which was to inject the myFusebox.* assignments into the code at compilation time).

Changed 1 year ago by scorfield

  • milestone changed from Fusebox 5.5 to Fusebox 5.6

I like this change but as it's a grammar change I'm deferring to 5.6.

Note: See TracTickets for help on using tickets.