protected override void OnInit()

in src/DeloitteDigital.Atlas/Mvvm/SublayoutView.cs [61:87]


        protected override void OnInit(EventArgs e)
        {
            try
            {
                var dataSource = this.viewHelper.GetDataSource(this);

                if (!DisableDataSourceValidation && (dataSource == null))
                {
                    // Display no data source reactive warning control if available
                    this.viewHelper.ShowReactiveWarning<IDataSourceWarning>(this);
                }

                // Initialise view model instance by the inheriting sub-layout
                ViewModel = InitialiseViewModel(dataSource);
            }
            catch (Exception ex)
            {
                // Log unhandled exception to Sitecore log
                Sitecore.Diagnostics.Log.Error(ex.ToString(), this);
                // Display error reactive warning control if available
                this.viewHelper.ShowReactiveWarning<IErrorWarning>(this);
                // Turn on the HasError flag
                HasError = true;
            }

            base.OnInit(e);
        }