From 10db166bbe510af27cb20cc0f028537af0df9c41 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 19 Oct 2017 10:22:07 +0200 Subject: [PATCH] Upgrade client dependencies and fix error logs --- .../app/shared/rest/rest-extractor.service.ts | 21 ++-- client/yarn.lock | 96 ++++++++++--------- server/middlewares/validators/videos.ts | 4 +- 3 files changed, 67 insertions(+), 54 deletions(-) diff --git a/client/src/app/shared/rest/rest-extractor.service.ts b/client/src/app/shared/rest/rest-extractor.service.ts index b560e2fe4..59dea7880 100644 --- a/client/src/app/shared/rest/rest-extractor.service.ts +++ b/client/src/app/shared/rest/rest-extractor.service.ts @@ -46,15 +46,18 @@ export class RestExtractor { console.error('An error occurred:', errorMessage) } else if (err.status !== undefined) { // A server-side error occurred. - // TODO: remove when angular/angular#19477 (comment) is fixed - let body = JSON.parse(err.error) - if (body) { - if (body.errors) { - const errors = body.errors - const error = errors[Object.keys(errors)[0]] - errorMessage = error.msg // Take the message of the first error - } else if (body.error) { - errorMessage = body.error + if (err.error) { + if (err.error.errors) { + const errors = err.error.errors + const errorsArray: string[] = [] + + Object.keys(errors).forEach(key => { + errorsArray.push(errors[key].msg) + }) + + errorMessage = errorsArray.join('. ') + } else if (err.error.error) { + errorMessage = err.error.error } } errorMessage = errorMessage ? errorMessage : 'Unknown error.' diff --git a/client/yarn.lock b/client/yarn.lock index bcfcc8dec..b63c76e2f 100644 --- a/client/yarn.lock +++ b/client/yarn.lock @@ -3,70 +3,70 @@ "@angular/animations@~4.4.0": - version "4.4.4" - resolved "https://registry.yarnpkg.com/@angular/animations/-/animations-4.4.4.tgz#a2f9353604347abe15df98292058842f52f08bc2" + version "4.4.6" + resolved "https://registry.yarnpkg.com/@angular/animations/-/animations-4.4.6.tgz#fa661899a8a4e38cb7c583c7a5c97ce65d592a35" dependencies: tslib "^1.7.1" "@angular/common@~4.4.0": - version "4.4.4" - resolved "https://registry.yarnpkg.com/@angular/common/-/common-4.4.4.tgz#ae0a818aaa0c6a3f0901e7b80bd94e1c22eb9365" + version "4.4.6" + resolved "https://registry.yarnpkg.com/@angular/common/-/common-4.4.6.tgz#4b81420724e0828a0e839b95a55eb1a7e83918f2" dependencies: tslib "^1.7.1" "@angular/compiler-cli@~4.4.0": - version "4.4.4" - resolved "https://registry.yarnpkg.com/@angular/compiler-cli/-/compiler-cli-4.4.4.tgz#063080a497d9175396825050222c717da184f6cf" + version "4.4.6" + resolved "https://registry.yarnpkg.com/@angular/compiler-cli/-/compiler-cli-4.4.6.tgz#bafd3d1e260e99087eb9a8cf7532dbd603abb9b1" dependencies: - "@angular/tsc-wrapped" "4.4.4" + "@angular/tsc-wrapped" "4.4.6" minimist "^1.2.0" reflect-metadata "^0.1.2" "@angular/compiler@~4.4.0": - version "4.4.4" - resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-4.4.4.tgz#326eb0029d9a3541aaca124def9adc51c36f2b41" + version "4.4.6" + resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-4.4.6.tgz#2ee1faf25b757e1d128979074be7fae529b3bc20" dependencies: tslib "^1.7.1" "@angular/core@~4.4.0": - version "4.4.4" - resolved "https://registry.yarnpkg.com/@angular/core/-/core-4.4.4.tgz#bd37ecf54158f97489996c9386bd222f80a32f5c" + version "4.4.6" + resolved "https://registry.yarnpkg.com/@angular/core/-/core-4.4.6.tgz#13031fd10dcfe438875419b38f21120958bc2354" dependencies: tslib "^1.7.1" "@angular/forms@~4.4.0": - version "4.4.4" - resolved "https://registry.yarnpkg.com/@angular/forms/-/forms-4.4.4.tgz#4db3790509b6b10f1db8a7c1b7f52187cf64cfd4" + version "4.4.6" + resolved "https://registry.yarnpkg.com/@angular/forms/-/forms-4.4.6.tgz#fe64ace42435c1b80f49034b7c41ce8caf14a44a" dependencies: tslib "^1.7.1" "@angular/http@~4.4.0": - version "4.4.4" - resolved "https://registry.yarnpkg.com/@angular/http/-/http-4.4.4.tgz#667faf616bb624168eafae6ee92e5eba23a9d1f2" + version "4.4.6" + resolved "https://registry.yarnpkg.com/@angular/http/-/http-4.4.6.tgz#0af680c6710bdc026d940e225cfd0f6a5c005d0c" dependencies: tslib "^1.7.1" "@angular/platform-browser-dynamic@~4.4.0": - version "4.4.4" - resolved "https://registry.yarnpkg.com/@angular/platform-browser-dynamic/-/platform-browser-dynamic-4.4.4.tgz#c3c9eb854a528556a07054127932e527fa932e14" + version "4.4.6" + resolved "https://registry.yarnpkg.com/@angular/platform-browser-dynamic/-/platform-browser-dynamic-4.4.6.tgz#4d3d9a6a7bf2cf3de4058a615ae059eff641fa36" dependencies: tslib "^1.7.1" "@angular/platform-browser@~4.4.0": - version "4.4.4" - resolved "https://registry.yarnpkg.com/@angular/platform-browser/-/platform-browser-4.4.4.tgz#a3898e2e7ba9d84ffa0d47144c6971179c75aee6" + version "4.4.6" + resolved "https://registry.yarnpkg.com/@angular/platform-browser/-/platform-browser-4.4.6.tgz#a9839c547e1b654fa1d24a89780c8ba6ab8dcce0" dependencies: tslib "^1.7.1" "@angular/router@~4.4.0": - version "4.4.4" - resolved "https://registry.yarnpkg.com/@angular/router/-/router-4.4.4.tgz#7be391096e843cb3e04f9f05d1d65a88df9bc7cf" + version "4.4.6" + resolved "https://registry.yarnpkg.com/@angular/router/-/router-4.4.6.tgz#0f6ad29ae0ff8d2c9ea379bd320447217b7ec866" dependencies: tslib "^1.7.1" -"@angular/tsc-wrapped@4.4.4": - version "4.4.4" - resolved "https://registry.yarnpkg.com/@angular/tsc-wrapped/-/tsc-wrapped-4.4.4.tgz#9841821e55616b826ca160250fe85e15fc74ffc3" +"@angular/tsc-wrapped@4.4.6": + version "4.4.6" + resolved "https://registry.yarnpkg.com/@angular/tsc-wrapped/-/tsc-wrapped-4.4.6.tgz#16787cbbf50bdc7e738123b19c32527f244e178d" dependencies: tsickle "^0.21.0" @@ -107,8 +107,8 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.25.tgz#66ecaf4df93f5281b48427ee96fbcdfc4f0cdce1" "@types/node@^8.0.33": - version "8.0.33" - resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.33.tgz#1126e94374014e54478092830704f6ea89df04cd" + version "8.0.45" + resolved "https://registry.yarnpkg.com/@types/node/-/node-8.0.45.tgz#89fad82439d5624e1b5c6b42f0f5d85136dcdecc" "@types/parse-torrent-file@*": version "4.0.1" @@ -884,8 +884,8 @@ babel-plugin-transform-strict-mode@^6.24.1: babel-types "^6.24.1" babel-preset-env@^1.5.2: - version "1.6.0" - resolved "https://registry.yarnpkg.com/babel-preset-env/-/babel-preset-env-1.6.0.tgz#2de1c782a780a0a5d605d199c957596da43c44e4" + version "1.6.1" + resolved "https://registry.yarnpkg.com/babel-preset-env/-/babel-preset-env-1.6.1.tgz#a18b564cc9b9afdf4aae57ae3c1b0d99188e6f48" dependencies: babel-plugin-check-es2015-constants "^6.22.0" babel-plugin-syntax-trailing-function-commas "^6.22.0" @@ -1977,6 +1977,12 @@ debug@2.6.8, debug@^2.0.0, debug@^2.1.0, debug@^2.1.1, debug@^2.1.3, debug@^2.2. dependencies: ms "2.0.0" +debug@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" + dependencies: + ms "2.0.0" + decamelize@^1.0.0, decamelize@^1.1.1, decamelize@^1.1.2: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" @@ -5777,8 +5783,8 @@ resolve-from@^1.0.0: resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" resolve-url-loader@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/resolve-url-loader/-/resolve-url-loader-2.1.0.tgz#27c95cc16a4353923fdbdc2dbaf5eef22232c477" + version "2.1.1" + resolved "https://registry.yarnpkg.com/resolve-url-loader/-/resolve-url-loader-2.1.1.tgz#5354e87381aae348371e555172c50816708e6c1c" dependencies: adjust-sourcemap-loader "^1.1.0" camelcase "^4.0.0" @@ -5870,8 +5876,8 @@ rx-lite@^3.1.2: resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-3.1.2.tgz#19ce502ca572665f3b647b10939f97fd1615f102" rxjs@^5.4.2: - version "5.4.3" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.4.3.tgz#0758cddee6033d68e0fd53676f0f3596ce3d483f" + version "5.5.0" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.5.0.tgz#26d8f3866eb700e247e0728a147c3d628993d812" dependencies: symbol-observable "^1.0.1" @@ -6716,10 +6722,14 @@ tsickle@^0.21.0: source-map "^0.5.6" source-map-support "^0.4.2" -tslib@^1.0.0, tslib@^1.5.0, tslib@^1.7.1, tslib@~1.7.1: +tslib@^1.0.0, tslib@^1.7.1, tslib@~1.7.1: version "1.7.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.7.1.tgz#bc8004164691923a79fe8378bbeb3da2017538ec" +tslib@^1.5.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.8.0.tgz#dc604ebad64bcbf696d613da6c954aa0e7ea1eb6" + tslint-config-standard@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/tslint-config-standard/-/tslint-config-standard-6.0.1.tgz#a04ba0a794759e877287056f549b081e47a56d6c" @@ -7049,8 +7059,8 @@ video.js@^5.19.2: xhr "2.2.2" video.js@^6.2.0: - version "6.3.2" - resolved "https://registry.yarnpkg.com/video.js/-/video.js-6.3.2.tgz#53f7cd08e4219157e4053b795673c3a9fb3d3072" + version "6.3.3" + resolved "https://registry.yarnpkg.com/video.js/-/video.js-6.3.3.tgz#e91f9fbb18062d2fd8c0e162db96d95caf78e3d4" dependencies: babel-runtime "^6.9.2" global "4.3.2" @@ -7152,8 +7162,8 @@ webpack-dev-middleware@^1.11.0: time-stamp "^2.0.0" webpack-dev-server@^2.4.5: - version "2.9.1" - resolved "https://registry.yarnpkg.com/webpack-dev-server/-/webpack-dev-server-2.9.1.tgz#7ac9320b61b00eb65b2109f15c82747fc5b93585" + version "2.9.2" + resolved "https://registry.yarnpkg.com/webpack-dev-server/-/webpack-dev-server-2.9.2.tgz#0fbab915701d25a905a60e1e784df19727da800f" dependencies: ansi-html "0.0.7" array-includes "^3.0.3" @@ -7216,8 +7226,8 @@ webpack-sources@^1.0.1: source-map "~0.5.3" webpack@^3.3.0: - version "3.6.0" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-3.6.0.tgz#a89a929fbee205d35a4fa2cc487be9cbec8898bc" + version "3.8.1" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-3.8.1.tgz#b16968a81100abe61608b0153c9159ef8bb2bd83" dependencies: acorn "^5.0.0" acorn-dynamic-import "^2.0.0" @@ -7253,8 +7263,8 @@ websocket-extensions@>=0.1.1: resolved "https://registry.yarnpkg.com/websocket-extensions/-/websocket-extensions-0.1.1.tgz#76899499c184b6ef754377c2dbb0cd6cb55d29e7" webtorrent@^0.98.0: - version "0.98.19" - resolved "https://registry.yarnpkg.com/webtorrent/-/webtorrent-0.98.19.tgz#9ce15fe71ea12600aa85ee12a9793eac88087262" + version "0.98.20" + resolved "https://registry.yarnpkg.com/webtorrent/-/webtorrent-0.98.20.tgz#f335869185a64447b6fe730c3c66265620b8c14a" dependencies: addr-to-ip-port "^1.4.2" bitfield "^1.1.2" @@ -7262,14 +7272,14 @@ webtorrent@^0.98.0: bittorrent-protocol "^2.1.5" chunk-store-stream "^2.0.2" create-torrent "^3.24.5" - debug "^2.2.0" + debug "^3.1.0" end-of-stream "^1.1.0" fs-chunk-store "^1.6.2" immediate-chunk-store "^1.0.8" inherits "^2.0.1" load-ip-set "^1.2.7" memory-chunk-store "^1.2.0" - mime "^1.3.4" + mime "^1.4.1" multistream "^2.0.5" package-json-versionify "^1.0.2" parse-torrent "^5.8.0" diff --git a/server/middlewares/validators/videos.ts b/server/middlewares/validators/videos.ts index f63348e66..3f881e1b5 100644 --- a/server/middlewares/validators/videos.ts +++ b/server/middlewares/validators/videos.ts @@ -24,8 +24,8 @@ import { const videosAddValidator = [ body('videofile').custom((value, { req }) => isVideoFile(req.files)).withMessage( - 'This file is not supported. Are you sure it is of the following type : ' - + CONSTRAINTS_FIELDS.VIDEOS.EXTNAME + 'This file is not supported. Please, make sure it is of the following type : ' + + CONSTRAINTS_FIELDS.VIDEOS.EXTNAME.join(', ') ), body('name').custom(isVideoNameValid).withMessage('Should have a valid name'), body('category').custom(isVideoCategoryValid).withMessage('Should have a valid category'), -- 2.25.1