Added an application Object to use for dispatching an error event.

Signed-off-by: Simon Bailey <simon@newtriks.com>