Code refactoring for bpa operator
[icn.git] / cmd / bpa-operator / vendor / github.com / emicklei / go-restful / service_error.go
1 package restful
2
3 // Copyright 2013 Ernest Micklei. All rights reserved.
4 // Use of this source code is governed by a license
5 // that can be found in the LICENSE file.
6
7 import "fmt"
8
9 // ServiceError is a transport object to pass information about a non-Http error occurred in a WebService while processing a request.
10 type ServiceError struct {
11         Code    int
12         Message string
13 }
14
15 // NewError returns a ServiceError using the code and reason
16 func NewError(code int, message string) ServiceError {
17         return ServiceError{Code: code, Message: message}
18 }
19
20 // Error returns a text representation of the service error
21 func (s ServiceError) Error() string {
22         return fmt.Sprintf("[ServiceError:%v] %v", s.Code, s.Message)
23 }