placing the http range error in objct-api-errors. (#2150)

This commit is contained in:
karthic rao 2016-07-09 05:52:55 +05:30 committed by Harshavardhana
parent cb415ef12e
commit 778b870b77
2 changed files with 15 additions and 15 deletions

View File

@ -17,7 +17,6 @@
package main
import (
"errors"
"fmt"
"regexp"
"strconv"
@ -28,20 +27,6 @@ const (
byteRangePrefix = "bytes="
)
// errInvalidRange - returned when given range value is not valid.
var errInvalidRange = errors.New("Invalid range")
// InvalidRange - invalid range typed error.
type InvalidRange struct {
offsetBegin int64
offsetEnd int64
resourceSize int64
}
func (e InvalidRange) Error() string {
return fmt.Sprintf("The requested range \"bytes %d-%d/%d\" is not satisfiable.", e.offsetBegin, e.offsetEnd, e.resourceSize)
}
// Valid byte position regexp
var validBytePos = regexp.MustCompile(`^[0-9]+$`)

View File

@ -17,6 +17,7 @@
package main
import (
"errors"
"fmt"
"io"
)
@ -205,6 +206,20 @@ func (e IncompleteBody) Error() string {
return e.Bucket + "#" + e.Object + "has incomplete body"
}
// errInvalidRange - returned when given range value is not valid.
var errInvalidRange = errors.New("Invalid range")
// InvalidRange - invalid range typed error.
type InvalidRange struct {
offsetBegin int64
offsetEnd int64
resourceSize int64
}
func (e InvalidRange) Error() string {
return fmt.Sprintf("The requested range \"bytes %d-%d/%d\" is not satisfiable.", e.offsetBegin, e.offsetEnd, e.resourceSize)
}
/// Multipart related errors.
// MalformedUploadID malformed upload id.