|
Revision 337, 0.8 kB
(checked in by scorfield, 2 years ago)
|
|
Added cf:throw from Barney Boisvert.
|
| Line | |
|---|
| 1 | <cfscript> |
|---|
| 2 | // Author: Barney Boisvert (bboisvert@gmail.com) |
|---|
| 3 | // custom verb that compiles to a <cfthrow /> tag |
|---|
| 4 | // usage: |
|---|
| 5 | // 1. add the lexicon declaration to your circuit file: |
|---|
| 6 | // <circuit xmlns:cf="cf/"> |
|---|
| 7 | // 2. use the verb in a fuseaction (all attributes optional): |
|---|
| 8 | // <cf:throw/> |
|---|
| 9 | // <cf:throw type="error type" message="custom error message" detail="more details" /> |
|---|
| 10 | if (fb_.verbInfo.executionMode is "start") { |
|---|
| 11 | fb_.keys = listToArray("type,message,detail"); |
|---|
| 12 | fb_.result = '<cfthrow'; |
|---|
| 13 | for (fb_.i = 1; fb_.i LTE arrayLen(fb_.keys); fb_.i = fb_.i + 1) { |
|---|
| 14 | if (structKeyExists(fb_.verbInfo.attributes, fb_.keys[fb_.i])) { |
|---|
| 15 | fb_.result = fb_.result & ' #fb_.keys[fb_.i]#="#fb_.verbInfo.attributes[fb_.keys[fb_.i]]#"'; |
|---|
| 16 | } |
|---|
| 17 | } |
|---|
| 18 | fb_appendLine(fb_.result & ' />'); |
|---|
| 19 | } |
|---|
| 20 | </cfscript> |
|---|