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

master
karthic rao 8 years ago committed by Harshavardhana
parent cb415ef12e
commit 778b870b77
  1. 15
      httprange.go
  2. 15
      object-errors.go

@ -17,7 +17,6 @@
package main package main
import ( import (
"errors"
"fmt" "fmt"
"regexp" "regexp"
"strconv" "strconv"
@ -28,20 +27,6 @@ const (
byteRangePrefix = "bytes=" 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 // Valid byte position regexp
var validBytePos = regexp.MustCompile(`^[0-9]+$`) var validBytePos = regexp.MustCompile(`^[0-9]+$`)

@ -17,6 +17,7 @@
package main package main
import ( import (
"errors"
"fmt" "fmt"
"io" "io"
) )
@ -205,6 +206,20 @@ func (e IncompleteBody) Error() string {
return e.Bucket + "#" + e.Object + "has incomplete body" 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. /// Multipart related errors.
// MalformedUploadID malformed upload id. // MalformedUploadID malformed upload id.

Loading…
Cancel
Save