When first starting to use Parsley the black-magic that is happening behind the scenes may confound some people.
Parsley purposely swallows runtime errors in order to not disrupts its messaging flow. You may see something like
DefaultMessageProcessor Message Target threw Error
The author of Parsley Jens Halm explains his reasoning behind this in this thread on the spicefactory forums
In larger application where Parsley messaging are kicking off complicated routines - the lack of detail that Parsley logs when swallowing errors can be prohibitive in finding the source of the Error - and if you don't know to look at your console the Errors will be effectively failing silently.
In Parsley 2.1 Jens introduced the [MessageError] metadata. This can be applied globally to all Errors that happen during the flow of a Parsley message or on a selector basis.
In our application we recently implemented a way through this new hook to catch and throw these errors - giving you valuable stack trace information - ultimately revealing the source of your Error. This makes it much easier to track down the source
package
{
import org.spicefactory.parsley.core.messaging.MessageProcessor;
public class ParsleyErrorBroker
{
[MessageError]
public function handleError (processor:MessageProcessor, error:Error):void {
throw error;
}
}
}
}
After writing this class you have to add the following to your compiler arguments
-keep-as3-metadata=MessageError
Add this class to your Parsley Context - and you're set- after that all Errors will be routed to this class and thrown.
If you have any questions feel free to post below