Browse Source

CLIs - fix bash exit codes

ondratra 3 years ago
parent
commit
980378ffba

+ 14 - 12
cli/src/ExitCodes.ts

@@ -1,18 +1,20 @@
 enum ExitCodes {
   OK = 0,
 
-  InvalidInput = 400,
-  FileNotFound = 401,
-  InvalidFile = 402,
-  NoAccountFound = 403,
-  NoAccountSelected = 404,
-  AccessDenied = 405,
+  InvalidInput = 40,
+  FileNotFound = 41,
+  InvalidFile = 42,
+  NoAccountFound = 43,
+  NoAccountSelected = 44,
+  AccessDenied = 45,
 
-  UnexpectedException = 500,
-  FsOperationFailed = 501,
-  ApiError = 502,
-  StorageNodeError = 503,
-  ActionCurrentlyUnavailable = 504,
-  QueryNodeError = 505,
+  UnexpectedException = 50,
+  FsOperationFailed = 51,
+  ApiError = 52,
+  StorageNodeError = 53,
+  ActionCurrentlyUnavailable = 54,
+  QueryNodeError = 55,
+
+  // NOTE: never exceed exit code 255 or it will be modulated by `256` and create problems
 }
 export = ExitCodes

+ 6 - 4
distributor-node/src/command-base/ExitCodes.ts

@@ -1,9 +1,11 @@
 enum ExitCodes {
   OK = 0,
   Error = 1,
-  ApiError = 200,
-  InvalidInput = 400,
-  FileNotFound = 401,
-  InvalidFile = 402,
+  ApiError = 20,
+  InvalidInput = 40,
+  FileNotFound = 41,
+  InvalidFile = 42,
+
+  // NOTE: never exceed exit code 255 or it will be modulated by `256` and create problems
 }
 export = ExitCodes

+ 2 - 0
storage-node/src/command-base/ExitCodes.ts

@@ -13,6 +13,8 @@ enum ExitCodes {
   ServerError,
   ApiError = 200,
   UnsuccessfulRuntimeCall,
+
+  // NOTE: never exceed exit code 255 or it will be modulated by `256` and create problems
 }
 
 export = ExitCodes