Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Why error handling is not available to me #4063


User avatar
0
ramezani583 created

hi, Why does not go to "catch" when an error occurred? Why error handling is not available to me?

protected virtual async Task CreateStudentAsync(CreateOrUpdateStudentInput input)
        {
            
            var student = new Student
            {
                StudentNumber = input.Student.StudentNumber,
                Name = input.Student.Name,
                Surname = input.Student.Surname,
                Degree = input.Student.Degree
            };
            try
            {
                await _studentRepository.InsertAsync(student); //It's done to get Id of the student.
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
            
        }

1 Answer(s)
  • User Avatar
    0
    aaron created
    Support Team

    Please format code properly.

    Did you put a breakpoint at Console.WriteLine(e)?