From 9ab620c7be6d7369d00c256a056e636aa4785fcc Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Tue, 23 Oct 2018 18:28:23 -0700 Subject: [PATCH] watchtower/wtwire/error_code: add shared error codes --- watchtower/wtwire/error_code.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 watchtower/wtwire/error_code.go diff --git a/watchtower/wtwire/error_code.go b/watchtower/wtwire/error_code.go new file mode 100644 index 000000000..6a441784a --- /dev/null +++ b/watchtower/wtwire/error_code.go @@ -0,0 +1,20 @@ +package wtwire + +// ErrorCode represents a generic error code used when replying to watchtower +// clients. Specific reply messages may extend the ErrorCode primitive and add +// custom codes, so long as they don't collide with the generic error codes.. +type ErrorCode uint16 + +const ( + // CodeOK signals that the request was successfully processed by the + // watchtower. + CodeOK ErrorCode = 0 + + // CodeTemporaryFailure alerts the client that the watchtower is + // temporarily unavailable, but that it may try again at a later time. + CodeTemporaryFailure ErrorCode = 40 + + // CodePermanentFailure alerts the client that the watchtower has + // permanently failed, and further communication should be avoided. + CodePermanentFailure ErrorCode = 50 +)