1package 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
7import "fmt"
8
9// ServiceError is a transport object to pass information about a non-Http error occurred in a WebService while processing a request.
10type ServiceError struct {
11	Code    int
12	Message string
13}
14
15// NewError returns a ServiceError using the code and reason
16func 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
21func (s ServiceError) Error() string {
22	return fmt.Sprintf("[ServiceError:%v] %v", s.Code, s.Message)
23}
24