EntietyFramework cannot catch DbUpdateException

I am having an issue with catching the DbUpdateException when deleting an object that is related to other tables from MySQL database and DbContext.SaveChanges() throws that exact exception.

The following code does not catch the exception:

    public async Task<ActionResult<JobTitle>> DeleteJobtitle(int id) {
        var jobtitle = await _context.Jobtitle.FindAsync(id);

        if (jobtitle == null) {
            return NotFound();
        }

        _context.Jobtitle.Remove(jobtitle);

        try {
            _context.SaveChanges();
        }
        catch (DbUpdateException ex) {
            Console.WriteLine("exception: " + ex.Message);
        }

        return jobtitle;
    }

And this is the console output when exception occurs:

 Microsoft.EntityFrameworkCore.Database.Command[20102]
  Failed executing DbCommand (1,601ms) [Parameters=[@p0='?' (DbType = Int32)], CommandType='Text', CommandTimeout='30']
  DELETE FROM `jobtitle`
  WHERE `idJobTitle` = @p0;
  SELECT ROW_COUNT();
fail: Microsoft.EntityFrameworkCore.Update[10000]
  An exception occurred in the database while saving changes for context type 'DbAPI.DbContexts.DbContext'.
  Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while updating the entries. See the inner exception for details.

Why doesn't my try catch block catch the exception?