mirror of
https://github.com/kopia/kopia.git
synced 2026-01-27 07:48:06 -05:00
22 lines
463 B
Go
22 lines
463 B
Go
package server
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/kopia/kopia/internal/serverapi"
|
|
)
|
|
|
|
type apiError struct {
|
|
httpErrorCode int
|
|
apiErrorCode serverapi.APIErrorCode
|
|
message string
|
|
}
|
|
|
|
func requestError(apiErrorCode serverapi.APIErrorCode, message string) *apiError {
|
|
return &apiError{400, apiErrorCode, message}
|
|
}
|
|
|
|
func internalServerError(err error) *apiError {
|
|
return &apiError{500, serverapi.ErrorInternal, fmt.Sprintf("internal server error: %v", err)}
|
|
}
|