From 8dd9654d820e55924c830cb4c36f7b45f0cde246 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=B6=9B?= Date: Fri, 12 Aug 2022 11:40:21 +0800 Subject: [PATCH] =?UTF-8?q?enhance(error):=E5=A2=9E=E5=8A=A0=E4=B8=A4?= =?UTF-8?q?=E4=B8=AA=E5=B7=A5=E5=85=B7=E5=BC=82=E5=B8=B8=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- exceptions/not_found.go | 13 +++++++++++++ exceptions/unsuccessful.go | 11 +++++++++++ 2 files changed, 24 insertions(+) create mode 100644 exceptions/not_found.go create mode 100644 exceptions/unsuccessful.go diff --git a/exceptions/not_found.go b/exceptions/not_found.go new file mode 100644 index 0000000..eb9053a --- /dev/null +++ b/exceptions/not_found.go @@ -0,0 +1,13 @@ +package exceptions + +type NotFoundError struct { + Message string +} + +func NewNotFoundError(msg string) *NotFoundError { + return &NotFoundError{Message: msg} +} + +func (e NotFoundError) Error() string { + return e.Message +} diff --git a/exceptions/unsuccessful.go b/exceptions/unsuccessful.go new file mode 100644 index 0000000..22a9da9 --- /dev/null +++ b/exceptions/unsuccessful.go @@ -0,0 +1,11 @@ +package exceptions + +type UnsuccessfulOperationError struct{} + +func NewUnsuccessfulOperationError() *UnsuccessfulOperationError { + return &UnsuccessfulOperationError{} +} + +func (UnsuccessfulOperationError) Error() string { + return "Unsuccessful Operation" +}