After my form submits I am calling a controller method that runs an orm EntitySave in my cfc. I would like to dump out the arguments before I save my data via ORM just to visually validate those are indeed the values I want to save in the database.
So when I use this
<cfthrow message="value = #arguments#">
I am getting this:
Error: Complex object types cannot be converted to simple values.
I understand you are not allowed to do this with complex objects, so in those cases I would use <cfdump> but I can’t find a way to dump in a <cfthrow>. I am sure there is a better way to accomplish this. I have also tried doing a <cfmail> to myself which works amazingly but the email will take a minute or two. Any suggestions would be greatly appreciated. I am currently checking into ValidateThis.
You could serialise it:
But I don’t think you want that sort of thing showing up on the screen.
I’d log it if I was you (so same notion, just
<cflog>before the<cfthrow>, and put the arguments in the log entry, and in the<cfthrow>just put a brief explanation of the error (you should also use a TYPE attribute, for subsequent handling of the exception that you’ve raised.