mirror of
https://github.com/crypto-pro-web/crypto-pro-js.git
synced 2024-11-23 16:44:59 +03:00
Возврат ошибок с кодом.
This commit is contained in:
parent
70a563ed53
commit
e70f108675
7
dist/crypto-pro.d.ts
vendored
7
dist/crypto-pro.d.ts
vendored
@ -1,7 +0,0 @@
|
||||
// Type definitions for crypto-pro 2.2.0
|
||||
// Project: crypto-pro
|
||||
// Definitions by: Vitalii Goma https://github.com/vgoma
|
||||
|
||||
export as namespace cryptoPro;
|
||||
|
||||
export * from './api';
|
5113
dist/crypto-pro.js
vendored
5113
dist/crypto-pro.js
vendored
File diff suppressed because it is too large
Load Diff
1
dist/crypto-pro.js.map
vendored
1
dist/crypto-pro.js.map
vendored
File diff suppressed because one or more lines are too long
9
dist/crypto-pro.min.js
vendored
9
dist/crypto-pro.min.js
vendored
File diff suppressed because one or more lines are too long
1
dist/crypto-pro.min.js.map
vendored
1
dist/crypto-pro.min.js.map
vendored
File diff suppressed because one or more lines are too long
@ -1,12 +1,15 @@
|
||||
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
|
||||
# For additional information regarding the format and rule options, please see:
|
||||
# https://github.com/browserslist/browserslist#queries
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
# You can see what browsers were selected by your queries by running:
|
||||
# npx browserslist
|
||||
case `uname` in
|
||||
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
> 0.5%
|
||||
last 2 versions
|
||||
Firefox ESR
|
||||
not dead
|
||||
not IE 9-11 # For IE 9-11 support, remove 'not'.
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/node_modules/browserslist/cli.js" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/node_modules/browserslist/cli.js" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
||||
|
5
lib/crypto-pro.d.ts
vendored
5
lib/crypto-pro.d.ts
vendored
@ -1,5 +0,0 @@
|
||||
// Type definitions for crypto-pro 2.2.0
|
||||
// Project: crypto-pro
|
||||
// Definitions by: Vitalii Goma https://github.com/vgoma
|
||||
|
||||
export * from './api';
|
4705
lib/crypto-pro.js
4705
lib/crypto-pro.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "crypto-pro",
|
||||
"name": "crypto-pro-custom",
|
||||
"version": "2.2.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
|
30
package.json
30
package.json
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "crypto-pro",
|
||||
"name": "crypto-pro-custom",
|
||||
"version": "2.2.0",
|
||||
"description": "API для взаимодействия с КриптоПро",
|
||||
"description": "Кастомизированный API для взаимодействия с КриптоПро",
|
||||
"main": "./lib/crypto-pro.js",
|
||||
"types": "./lib/crypto-pro.d.ts",
|
||||
"files": [
|
||||
@ -20,29 +20,35 @@
|
||||
"build:definition-header:esm": "cross-env TS_CONFIG=tsconfig-esm.json node definition-header.js",
|
||||
"build:esm": "npm run build:uncompressed:esm && npm run build:definition-header:esm",
|
||||
"build": "npm run clean && npm run build:es5 && npm run build:esm",
|
||||
"pack:clean": "cross-env-shell rimraf $npm_package_name-$npm_package_version.tgz",
|
||||
"pack:uncompress": "cross-env-shell tar xopf $npm_package_name-$npm_package_version.tgz",
|
||||
"pack:clean": "cross-env rimraf %npm_package_name%-%npm_package_version%.tgz",
|
||||
"pack:uncompress": "cross-env tar xopf %npm_package_name%-%npm_package_version%.tgz",
|
||||
"test": "jest --coverage && coveralls < coverage/lcov.info",
|
||||
"lint": "eslint --config .eslintrc.js './src/**/*'",
|
||||
"lint:fix": "eslint --fix --config .eslintrc.js './src/**/*'",
|
||||
"lint": "eslint --config .eslintrc.js --ext .ts --ext .js src",
|
||||
"lint:fix": "eslint --fix --config .eslintrc.js --ext .ts --ext .js src",
|
||||
"examples-update": "npm run examples-update:script-tag && npm run examples-update:angular && npm run examples-update:react",
|
||||
"examples-update:script-tag": "npm --prefix ./examples/script-tag r crypto-pro && npm --prefix ./examples/script-tag i crypto-pro",
|
||||
"examples-update:angular": "npm --prefix ./examples/angular r crypto-pro && npm --prefix ./examples/angular i crypto-pro",
|
||||
"examples-update:react": "npm --prefix ./examples/react r crypto-pro && npm --prefix ./examples/react i crypto-pro",
|
||||
"prepack": "npm run build",
|
||||
"postpack": "npm run pack:uncompress && npm run pack:clean",
|
||||
"prepublishOnly": "npm run lint && jest && npm run build",
|
||||
"postpublish": "npm run examples-update"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/vgoma/crypto-pro"
|
||||
"url": "https://github.com/kernusr/crypto-pro"
|
||||
},
|
||||
"author": {
|
||||
"name": "Vitalii Goma",
|
||||
"email": "vgoma@yandex.ru",
|
||||
"url": "https://github.com/vgoma"
|
||||
"name": "Artem Vasilev",
|
||||
"email": "kern.usr@gmail.com",
|
||||
"url": "https://github.com/kernusr"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Vitalii Goma",
|
||||
"email": "vgoma@yandex.ru",
|
||||
"url": "https://github.com/vgoma"
|
||||
}
|
||||
],
|
||||
"keywords": [
|
||||
"crypto",
|
||||
"cryptopro",
|
||||
@ -59,7 +65,7 @@
|
||||
"@typescript-eslint/eslint-plugin": "2.25.0",
|
||||
"@typescript-eslint/parser": "2.25.0",
|
||||
"coveralls": "3.0.11",
|
||||
"cross-env": "7.0.2",
|
||||
"cross-env": "^7.0.2",
|
||||
"eslint": "6.8.0",
|
||||
"eslint-config-prettier": "6.10.1",
|
||||
"eslint-plugin-prettier": "3.1.2",
|
||||
|
0
src/crypto-pro.ts → src/crypto-pro-custom.ts
Executable file → Normal file
0
src/crypto-pro.ts → src/crypto-pro-custom.ts
Executable file → Normal file
@ -5,15 +5,15 @@ describe('_extractMeaningfulErrorMessage', () => {
|
||||
test("returns meaningful message provided by vendor if it's possible", () => {
|
||||
expect(
|
||||
_extractMeaningfulErrorMessage(new Error('Какое-то более-менее подробное сообщение об ошибке. (0x8010006E)')),
|
||||
).toBe('Какое-то более-менее подробное сообщение об ошибке');
|
||||
).toBe('Какое-то более-менее подробное сообщение об ошибке (Код ошибки: 0x8010006E)');
|
||||
expect(
|
||||
_extractMeaningfulErrorMessage(new Error('Какое-то более-менее подробное сообщение об ошибке. (0x801')),
|
||||
).toBe('Какое-то более-менее подробное сообщение об ошибке');
|
||||
).toBe('Какое-то более-менее подробное сообщение об ошибке (Код ошибки: 0x801)');
|
||||
expect(_extractMeaningfulErrorMessage(new Error('Какое-то более-менее подробное сообщение об ошибке.(0x801'))).toBe(
|
||||
'Какое-то более-менее подробное сообщение об ошибке',
|
||||
'Какое-то более-менее подробное сообщение об ошибке (Код ошибки: 0x801)',
|
||||
);
|
||||
expect(_extractMeaningfulErrorMessage(new Error('Какое-то более-менее подробное сообщение об ошибке(0x801'))).toBe(
|
||||
'Какое-то более-менее подробное сообщение об ошибке',
|
||||
'Какое-то более-менее подробное сообщение об ошибке (Код ошибки: 0x801)',
|
||||
);
|
||||
expect(_extractMeaningfulErrorMessage(new Error('Какое-то более-менее подробное сообщение об ошибке.'))).toBe(
|
||||
'Какое-то более-менее подробное сообщение об ошибке',
|
||||
@ -28,9 +28,11 @@ describe('_extractMeaningfulErrorMessage', () => {
|
||||
'Какое-то более-менее. Подробное сообщение об ошибке',
|
||||
);
|
||||
expect(_extractMeaningfulErrorMessage(new Error('Какая-то error случилась, по причине 666 (0x801'))).toBe(
|
||||
'Какая-то error случилась, по причине 666',
|
||||
'Какая-то error случилась, по причине 666 (Код ошибки: 0x801)',
|
||||
);
|
||||
expect(_extractMeaningfulErrorMessage(new Error('Не удалось. 0x8010006E'))).toBe(
|
||||
'Не удалось (Код ошибки: 0x8010006E)',
|
||||
);
|
||||
expect(_extractMeaningfulErrorMessage(new Error('Не удалось. 0x8010006E'))).toBe('Не удалось');
|
||||
});
|
||||
|
||||
test("returns null if can't extract meaningful error message", () => {
|
||||
|
@ -15,7 +15,7 @@ export const _extractMeaningfulErrorMessage = (error: Error): string | null => {
|
||||
return null;
|
||||
}
|
||||
|
||||
const searchResult = errorContainer.message.match(/^(.*?)(?:(?:\.?\s?\(?(0x[0-9a-zA-Z]{1,8})\))|(?:\.?$))/);
|
||||
const searchResult = errorContainer.message.match(/^(.*?)(?:(?:\.?\s?\(?(0x[0-9a-zA-Z]{1,8})\)?)|(?:\.?$))/);
|
||||
|
||||
return (searchResult ? searchResult[1] + (searchResult[2] ? '. Код ошибки: ' + searchResult[2] : '') : null);
|
||||
return searchResult ? searchResult[1] + (searchResult[2] ? ' (Код ошибки: ' + searchResult[2] + ')' : '') : null;
|
||||
};
|
||||
|
@ -14,7 +14,7 @@
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"./src/crypto-pro.ts"
|
||||
"./src/crypto-pro-custom.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
|
Loading…
Reference in New Issue
Block a user