private void ButtonAddEmployee_Click(object sender, EventArgs e) { try { _controller.AddEmployee(this); Close(); } catch (Exception ex) when(ex is InvalidPersonDataException || ex is EmployeeWithOibAlreadyExistsException) { MessageBox.Show(ex.Message, @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }