"Fossies" - the Fresh Open Source Software Archive

Member "cli-1.1280.1/src/lib/errors/authentication-failed-error.ts" (20 Feb 2024, 392 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.

    1 import { CustomError } from './custom-error';
    2 import config from '../config';
    3 
    4 export function AuthFailedError(
    5   errorMessage: string = 'Authentication failed. Please check the API token on ' +
    6     config.ROOT,
    7   errorCode = 401,
    8 ) {
    9   const error = new CustomError(errorMessage);
   10   error.code = errorCode;
   11   error.strCode = 'authfail';
   12   error.userMessage = errorMessage;
   13   return error;
   14 }