-
Notifications
You must be signed in to change notification settings - Fork 576
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #691 from snyk/feat/unsupported-package-manager-error
feat: Unsupported package manager error
- Loading branch information
Showing
5 changed files
with
33 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import {CustomError} from './custom-error'; | ||
import * as pms from '../package-managers'; | ||
|
||
export class UnsupportedPackageManagerError extends CustomError { | ||
private static ERROR_MESSAGE: string = | ||
'Here are our supported package managers:' + | ||
`${Object.keys(pms.SUPPORTED_PACKAGE_MANAGER_NAME) | ||
.map((i) => '\n - ' + i + ' (' + pms.SUPPORTED_PACKAGE_MANAGER_NAME[i] + ')')} | ||
`; | ||
|
||
constructor(packageManager) { | ||
super(`Unsupported package manager ${packageManager}.` + UnsupportedPackageManagerError.ERROR_MESSAGE); | ||
this.code = 422; | ||
this.userMessage = `Unsupported package manager '${packageManager}''. ` + | ||
UnsupportedPackageManagerError.ERROR_MESSAGE; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters