dummyconnector.ts 736 B

1234567891011121314151617181920212223
  1. // Copyright (c) Jupyter Development Team.
  2. // Distributed under the terms of the Modified BSD License.
  3. import { DataConnector } from '@jupyterlab/statedb';
  4. import { CompletionHandler } from './handler';
  5. /**
  6. * DummyConnector's fetch method always returns a rejected Promise.
  7. * This class is only instantiated if both CompletionHandler._connector and
  8. * CompletionHandler._fetchItems are undefined.
  9. */
  10. export class DummyConnector extends DataConnector<
  11. CompletionHandler.IReply,
  12. void,
  13. CompletionHandler.IRequest
  14. > {
  15. fetch(_: CompletionHandler.IRequest): Promise<CompletionHandler.IReply> {
  16. return Promise.reject(
  17. 'Attempting to fetch with DummyConnector. Please ensure connector responseType is set.'
  18. );
  19. }
  20. }