Change ErrorCode to a concrete class, to allow it to be json serialized
Refactor failure handling

Split FailureInfo into ExecutionFailureInfo and FailureInfo, so that error codes can be propagated back from workers