code: private void configureExistingTaskScheduler(TaskScheduler taskScheduler,
                                                  BugsnagScheduledTaskExceptionHandler errorHandler) {
          try {
              Field errorHandlerField =
                      taskScheduler.getClass().getDeclaredField("errorHandler");
              errorHandlerField.setAccessible(true);
              Object existingErrorHandler = errorHandlerField.get(taskScheduler);
  
              // If an error handler has already been defined then make the Bugsnag handler
              // call this afterwards
              if (existingErrorHandler instanceof ErrorHandler) {
                  errorHandler.setExistingErrorHandler((ErrorHandler) existingErrorHandler);
              }
  
              // Add the bugsnag error handler to the scheduler.
              errorHandlerField.set(taskScheduler, errorHandler);
          } catch (Throwable ex) {
              LOGGER.warn("Bugsnag scheduled task exception handler could not be configured");
          }
      }
docs: If a task scheduler has been defined by the application, get it so that
  bugsnag error handling can be added.
  <p>
  Reflection is the simplest way to get and set an error handler
  because the error handler setter is only defined in the concrete classes,
  not the TaskScheduler interface.
  
  @param taskScheduler the task scheduler