@blockfrost/blockfrost-js
Advanced tools
Comparing version 4.2.0-beta.6 to 4.2.0-beta.7
@@ -35,9 +35,12 @@ import { CacheError, CancelError, TimeoutError, RequestError, ReadError, ParseError, UploadError, HTTPError, MaxRedirectsError, UnsupportedProtocolError, RequiredRetryOptions } from 'got'; | ||
export declare type HashOrNumber = string | number; | ||
export declare type ErrorType = { | ||
export declare type ErrorType = // Server error | ||
{ | ||
status_code: number; | ||
message: string; | ||
error: string; | ||
url: string; | ||
} | { | ||
message: string; | ||
code: string; | ||
url: string | undefined; | ||
}; | ||
@@ -44,0 +47,0 @@ export declare type PaginationOptions = { |
@@ -15,2 +15,3 @@ import { GotError, ErrorType } from '../types'; | ||
error: string; | ||
url: string; | ||
constructor(error: Extract<ErrorType, { | ||
@@ -22,2 +23,3 @@ status_code: number; | ||
code: string; | ||
url: string | undefined; | ||
constructor(error: Extract<ErrorType, { | ||
@@ -31,3 +33,4 @@ code: string; | ||
error: string; | ||
url: string; | ||
}; | ||
export declare const handleError: (error: GotError) => BlockfrostServerError | BlockfrostClientError; |
@@ -22,2 +22,3 @@ "use strict"; | ||
this.error = error.error; | ||
this.url = error.url; | ||
Object.setPrototypeOf(this, BlockfrostServerError.prototype); | ||
@@ -33,2 +34,3 @@ } | ||
this.message = error.message; | ||
this.url = error.url; | ||
Object.setPrototypeOf(this, BlockfrostClientError.prototype); | ||
@@ -53,7 +55,8 @@ } | ||
const handleError = (error) => { | ||
var _a, _b; | ||
var _a, _b, _c; | ||
if (error instanceof got_1.HTTPError) { | ||
const url = error.request.requestUrl; | ||
const responseBody = error.response.body; | ||
if ((0, exports.isBlockfrostErrorResponse)(responseBody)) { | ||
return new BlockfrostServerError(responseBody); | ||
return new BlockfrostServerError({ ...responseBody, url }); | ||
} | ||
@@ -68,2 +71,3 @@ else { | ||
error: statusText, | ||
url, | ||
}); | ||
@@ -76,5 +80,6 @@ } | ||
code: (_b = error.code) !== null && _b !== void 0 ? _b : 'ERR_GOT_REQUEST_ERROR', | ||
message: error.message, // getaddrinfo ENOTFOUND cardano-testnet.blockfrost.io' | ||
message: error.message, | ||
url: (_c = error.request) === null || _c === void 0 ? void 0 : _c.requestUrl, | ||
}); | ||
}; | ||
exports.handleError = handleError; |
{ | ||
"name": "@blockfrost/blockfrost-js", | ||
"version": "4.2.0-beta.6", | ||
"version": "4.2.0-beta.7", | ||
"description": "A JavaScript/TypeScript SDK for interacting with the https://blockfrost.io API", | ||
@@ -12,3 +12,2 @@ "keywords": [ | ||
"author": "blockfrost.io", | ||
"repository": "blockfrost/blockfrost-js", | ||
"main": "lib/index.js", | ||
@@ -21,3 +20,3 @@ "files": [ | ||
"build": "yarn clean && tsc", | ||
"type-check": "tsc --project tsconfig.types.json", | ||
"type-check": "tsc --project ./tsconfig.types.json", | ||
"clean": "rimraf lib", | ||
@@ -27,4 +26,2 @@ "generate-types": "openapi-typescript https://raw.githubusercontent.com/blockfrost/openapi/master/openapi.yaml --output ./src/types/OpenApi.ts", | ||
"prepublishOnly": "yarn build", | ||
"run-example:api": "ts-node-dev --transpile-only ./examples/basic/api.ts", | ||
"run-example:ipfs": "ts-node-dev --transpile-only ./examples/basic/ipfs.ts", | ||
"test": "yarn run-s 'test:*'", | ||
@@ -43,14 +40,6 @@ "test:unit": "jest -c ./jest.config.js --runInBand", | ||
"devDependencies": { | ||
"@commitlint/cli": "^17.0.2", | ||
"@commitlint/config-conventional": "^17.0.2", | ||
"@jest/globals": "^28.1.0", | ||
"@swc-node/jest": "^1.5.2", | ||
"@types/jest": "^28.1.0", | ||
"@types/node": "^17.0.38", | ||
"@typescript-eslint/eslint-plugin": "^5.27.0", | ||
"@typescript-eslint/parser": "5.27.0", | ||
"eslint": "8.16.0", | ||
"eslint-config-prettier": "8.5.0", | ||
"eslint-plugin-import": "2.26.0", | ||
"eslint-plugin-prettier": "4.0.0", | ||
"@types/node": "^14.6.0", | ||
"husky": "^8.0.1", | ||
@@ -66,8 +55,6 @@ "jest": "^28.1.0", | ||
"ts-jest": "^28.0.3", | ||
"ts-node": "10.8.0", | ||
"ts-node-dev": "^2.0.0", | ||
"typedoc": "^0.22.17", | ||
"typedoc": "^0.23.2", | ||
"typedoc-github-wiki-theme": "^1.0.1", | ||
"typedoc-plugin-markdown": "^3.12.1", | ||
"typescript": "4.7.2", | ||
"typedoc-plugin-markdown": "^3.13.1", | ||
"typescript": "^4.7.2", | ||
"yarn-run-all": "^3.1.1" | ||
@@ -74,0 +61,0 @@ }, |
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 README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
19
7952
0
313815
62
1
0