"Fossies" - the Fresh Open Source Software Archive

Member "cli-1.1280.1/src/lib/errors/failed-to-get-vulns-from-unavailable-resource.ts" (20 Feb 2024, 1004 Bytes) of package /linux/misc/snyk-cli-1.1280.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) TypeScript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

A hint: This file contains one or more very long lines, so maybe it is better readable using the pure text view mode that shows the contents as wrapped lines within the browser window.


    1 import { CustomError } from './custom-error';
    2 
    3 const errorNpmMessage =
    4   'Please check the version and package name and try running `snyk test` again.\nFor additional assistance, run `snyk help` or check out our docs \n(link to: https://support.snyk.io/hc/en-us/articles/360003851277#UUID-ba99a73f-110d-1f1d-9e7a-1bad66bf0996).';
    5 const errorRepositoryMessage =
    6   'Try testing this repository at https://snyk.io/test/.\nFor additional assistance, run `snyk help` or check out our docs \n(link to: https://support.snyk.io/hc/en-us/articles/360003851277#UUID-ba99a73f-110d-1f1d-9e7a-1bad66bf0996).';
    7 
    8 export function FailedToGetVulnsFromUnavailableResource(
    9   root: string,
   10   statusCode: number,
   11 ): CustomError {
   12   const isRepository = root.startsWith('http' || 'https');
   13   const errorMsg = `We couldn't test ${root}. ${
   14     isRepository ? errorRepositoryMessage : errorNpmMessage
   15   }`;
   16   const error = new CustomError(errorMsg);
   17   error.code = statusCode;
   18   error.userMessage = errorMsg;
   19   return error;
   20 }