@avst-api/commons
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -56,5 +56,12 @@ /// <reference types="runtime" /> | ||
errors: string[]; | ||
field: string; | ||
name: string; | ||
constructor(errors: string[]); | ||
constructor(errors: string[], field: string); | ||
} | ||
export declare class UserNotFoundError extends RequestValidationError { | ||
message: string; | ||
field: string; | ||
name: string; | ||
constructor(message: string, field: string); | ||
} | ||
export declare class UnexpectedError extends Error { | ||
@@ -61,0 +68,0 @@ originalError: any; |
13
index.js
@@ -39,8 +39,17 @@ export class HttpError extends Error { | ||
export class RequestValidationError extends Error { | ||
constructor(errors) { | ||
constructor(errors, field) { | ||
super(`Request validation errors: ${errors.join(', ')}`); | ||
this.errors = errors; | ||
this.field = field; | ||
this.name = 'RequestValidationError'; | ||
} | ||
} | ||
export class UserNotFoundError extends RequestValidationError { | ||
constructor(message, field) { | ||
super([message], field); | ||
this.message = message; | ||
this.field = field; | ||
this.name = 'UserNotFoundError'; | ||
} | ||
} | ||
export class UnexpectedError extends Error { | ||
@@ -219,3 +228,3 @@ constructor(originalError, message) { | ||
} | ||
throw new UnexpectedError(e, `Failed to read body`); | ||
throw new UnexpectedError(e, 'Failed to read body'); | ||
} | ||
@@ -222,0 +231,0 @@ } |
{ | ||
"name": "@avst-api/commons", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Commons for Adaptavist Managed APIs", | ||
"main": "index.js", | ||
"repository": "git@bitbucket.org:adaptavistlabs/adaptavist-api-common.git", | ||
"module": "index", | ||
"type": "module", | ||
"scripts": { | ||
"tsc": "node ./node_modules/typescript/bin/tsc", | ||
"build": "node ./node_modules/typescript/bin/tsc --outDir dist && cp package.json dist/package.json && cp readme.md dist/readme.md", | ||
"build": "rm -rf dist && tsc && cp package.json dist/package.json && cp readme.md dist/readme.md", | ||
"release": "sh ./publish.sh", | ||
"release:public": "sh ./publish-public.sh", | ||
"lint": "node ./node_modules/eslint/bin/eslint.js --ext ts ./", | ||
"lint-fix": "node ./node_modules/eslint/bin/eslint.js --fix --ext ts ./" | ||
"lint:fix": "node ./node_modules/eslint/bin/eslint.js --fix --ext ts ./" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+ssh://git@bitbucket.org/adaptavistlabs/adaptavist-api-common.git" | ||
}, | ||
"author": "Adaptavist", | ||
"license": "UNLICENSED", | ||
"homepage": "https://bitbucket.org/adaptavistlabs/adaptavist-api-common#readme", | ||
"dependencies": { | ||
@@ -21,0 +19,0 @@ "@avst-types/runtime": "^0.13.0" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24293
344
Yes
1