How to use the @argdown/core.ArgdownPluginError function in @argdown/core

To help you get started, we’ve selected a few @argdown/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github christianvoigt / argdown / packages / argdown-node / src / plugins / IncludePlugin.ts View on Github external
runAsync: IAsyncRequestHandler = async request => {
    if (!request.input) {
      throw new ArgdownPluginError(
        this.name,
        "missing-input-request-field",
        "Missing input."
      );
    }
    if (!request.inputPath) {
      throw new ArgdownPluginError(
        this.name,
        "missing-inputPath-request-field",
        "Missing input path."
      );
    }
    const settings = this.getSettings(request);
    settings.regEx!.lastIndex = 0;
    request.input = await this.replaceIncludesAsync(
      request.inputPath!,
github christianvoigt / argdown / packages / argdown-node / src / plugins / IncludePlugin.ts View on Github external
runAsync: IAsyncRequestHandler = async request => {
    if (!request.input) {
      throw new ArgdownPluginError(
        this.name,
        "missing-input-request-field",
        "Missing input."
      );
    }
    if (!request.inputPath) {
      throw new ArgdownPluginError(
        this.name,
        "missing-inputPath-request-field",
        "Missing input path."
      );
    }
    const settings = this.getSettings(request);
    settings.regEx!.lastIndex = 0;
    request.input = await this.replaceIncludesAsync(
      request.inputPath!,
      request.input!,
      settings.regEx!,
      []
    );
  };
  async replaceIncludesAsync(
github christianvoigt / argdown / packages / argdown-node / src / plugins / LoadFilePlugin.ts View on Github external
runAsync: IAsyncRequestHandler = async (request, _response, logger) => {
    const file = request.inputPath;
    if (!file) {
      throw new ArgdownPluginError(
        this.name,
        "missing-inputPath-request-field",
        "No inputPath field in request object."
      );
    }
    const input = await readFileAsync(file, "utf8");
    logger.log(
      "verbose",
      "[LoadFilePlugin]: Reading file completed, starting processing: " + file
    );
    request.input = input;
  };
}