Trigger a "resource-error" event on resource loading fails

refs #649