Add better distinction of error cases
Add a new NotFoundError exception for use internally, so we can track
specific failure cases.
Also add a new Error class as a central place to store our error
numbers consistently.
In the API protocol, add a "NOTFOUND" error string alongside "ERROR"
to help the admin interface and other callers distinguish error cases
better.
In the admin interface, actually return distinct non-zero errors in
failure cases. Previously, almost all failures would have returned
suceesfully to the calling shell.
Change-Id: Ie382b737a80b7cd41c551e3a4a2a7e0827260bdc
diff --git a/errors.py b/errors.py
index aec4619..25518e5 100644
--- a/errors.py
+++ b/errors.py
@@ -28,6 +28,11 @@
The critical error
"""
+class NotFoundError(VlandError):
+ """
+ Couldn't find object
+ """
+
class InputError(VlandError):
"""
Invalid input
@@ -48,3 +53,7 @@
CLI communication failure
"""
+class Error:
+ OK = 0
+ FAILED = 1
+ NOTFOUND = 2