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.
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 {
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}
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)