From ed36b2037393fda98f8eda1d5caa229f4820894d Mon Sep 17 00:00:00 2001 From: Charles Iliya Krempeaux Date: Fri, 19 Jul 2019 16:50:18 -0700 Subject: [PATCH] errhttp.URITooLong --- uritoolong.go | 32 ++++++++++++++++++++++++++++++++ uritoolong_test.go | 14 ++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 uritoolong.go create mode 100644 uritoolong_test.go diff --git a/uritoolong.go b/uritoolong.go new file mode 100644 index 0000000..b0025eb --- /dev/null +++ b/uritoolong.go @@ -0,0 +1,32 @@ +package errhttp + +type URITooLong interface { + ClientError + URITooLong() +} + +type internalURITooLong struct { + err error +} + +func URITooLongWrap(err error) error { + return internalURITooLong{ + err:err, + } +} + +func (receiver internalURITooLong) Error() string { + return receiver.err.Error() +} + +func (receiver internalURITooLong) Err() error { + return receiver.err +} + +func (internalURITooLong) ClientError() { + // Nothing here. +} + +func (internalURITooLong) URITooLong() { + // Nothing here. +} diff --git a/uritoolong_test.go b/uritoolong_test.go new file mode 100644 index 0000000..4ccf14c --- /dev/null +++ b/uritoolong_test.go @@ -0,0 +1,14 @@ +package errhttp + +import ( + "testing" +) + +func TestURITooLong(t *testing.T) { + + var x URITooLong = internalURITooLong{} // THIS IS THE LINE THAT ACTUALLY MATTERS IN THIS TEST. + + if nil == x { + t.Errorf("This should not happen.") + } +}