X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/f62ba0aeff590ef1c57669d4f46e43b5ee169522..0429d37860f633725ecff6bd923e196a61121881:/src/services/common-service/common-service.ts diff --git a/src/services/common-service/common-service.ts b/src/services/common-service/common-service.ts index 8e00c4ad1a..54c0edf6bf 100644 --- a/src/services/common-service/common-service.ts +++ b/src/services/common-service/common-service.ts @@ -68,6 +68,12 @@ export class CommonService { } } + private validateUuid(uuid: string) { + if (uuid === "") { + throw new Error('UUID cannot be empty string'); + } + } + static defaultResponse(promise: AxiosPromise, actions: ApiActions, mapKeys = true, showErrors = true): Promise { const reqId = uuid(); actions.progressFn(reqId, true); @@ -97,6 +103,7 @@ export class CommonService { } delete(uuid: string): Promise { + this.validateUuid(uuid); return CommonService.defaultResponse( this.serverApi .delete(this.resourceType + '/' + uuid), @@ -105,6 +112,7 @@ export class CommonService { } get(uuid: string, showErrors?: boolean) { + this.validateUuid(uuid); return CommonService.defaultResponse( this.serverApi .get(this.resourceType + '/' + uuid), @@ -148,6 +156,7 @@ export class CommonService { } update(uuid: string, data: Partial) { + this.validateUuid(uuid); return CommonService.defaultResponse( this.serverApi .put(this.resourceType + '/' + uuid, data && CommonService.mapKeys(_.snakeCase)(data)),