Add ssh keys panel
[arvados-workbench2.git] / src / services / common-service / common-resource-service.ts
index 70c1df0e2bc5e665a3c62c05b39b7a50a6705c62..02a3379dc2dde5369d31998e275105a11e7b8196 100644 (file)
@@ -35,6 +35,8 @@ export enum CommonResourceServiceError {
     UNIQUE_VIOLATION = 'UniqueViolation',
     OWNERSHIP_CYCLE = 'OwnershipCycle',
     MODIFYING_CONTAINER_REQUEST_FINAL_STATE = 'ModifyingContainerRequestFinalState',
+    UNIQUE_PUBLIC_KEY = 'UniquePublicKey',
+    INVALID_PUBLIC_KEY = 'InvalidPublicKey',
     UNKNOWN = 'Unknown',
     NONE = 'None'
 }
@@ -150,6 +152,10 @@ export const getCommonResourceServiceError = (errorResponse: any) => {
                 return CommonResourceServiceError.OWNERSHIP_CYCLE;
             case /Mounts cannot be modified in state 'Final'/.test(error):
                 return CommonResourceServiceError.MODIFYING_CONTAINER_REQUEST_FINAL_STATE;
+            case /Public key does not appear to be a valid ssh-rsa or dsa public key/.test(error):
+                return CommonResourceServiceError.INVALID_PUBLIC_KEY;
+            case /Public key already exists in the database, use a different key./.test(error):
+                return CommonResourceServiceError.UNIQUE_PUBLIC_KEY;
             default:
                 return CommonResourceServiceError.UNKNOWN;
         }