]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellLevel3CommandsLib/Alias.c
Shell/alias: Print detailed error when deleting alias
[mirror_edk2.git] / ShellPkg / Library / UefiShellLevel3CommandsLib / Alias.c
index 5a3b7e5913f133d2b992cf9a077b7f7ca0130a45..daf46a9f657a4ae034bb3e527654500d518af581 100644 (file)
@@ -2,7 +2,7 @@
   Main file for Alias shell level 3 function.\r
 \r
   (C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>\r
-  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved. <BR>\r
+  Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved. <BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -151,6 +151,18 @@ ShellCommandRunAlias (
       // delete an alias\r
       //\r
       Status = gEfiShellProtocol->SetAlias(Param1, NULL, TRUE, FALSE);\r
+      if (EFI_ERROR(Status)) {\r
+        if (Status == EFI_ACCESS_DENIED) {\r
+          ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), gShellLevel3HiiHandle, L"alias");\r
+          ShellStatus = SHELL_ACCESS_DENIED;\r
+        } else if (Status == EFI_NOT_FOUND) {\r
+          ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_NOT_FOUND), gShellLevel3HiiHandle, L"alias", Param1);\r
+          ShellStatus = SHELL_NOT_FOUND;\r
+        } else {\r
+          ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_UK), gShellLevel3HiiHandle, L"alias", Status);\r
+          ShellStatus = SHELL_DEVICE_ERROR;\r
+        }\r
+      }\r
     } else if (ShellCommandLineGetCount(Package) == 3) {\r
       //\r
       // must be adding an alias\r