2016-04-03 17:59:27 +00:00
package v1
import (
2016-04-05 20:22:13 +00:00
"strings"
2019-02-23 13:09:10 +00:00
"github.com/osuYozora/rippleapi/common"
2016-04-03 17:59:27 +00:00
)
// Boilerplate errors
var (
2016-04-16 16:05:24 +00:00
Err500 = common . SimpleResponse ( 500 , "An error occurred. Trying again may work. If it doesn't, yell at this Ripple instance admin and tell them to fix the API." )
ErrBadJSON = common . SimpleResponse ( 400 , "Your JSON for this request is invalid." )
2016-04-03 17:59:27 +00:00
)
2016-04-05 20:22:13 +00:00
// ErrMissingField generates a response to a request when some fields in the JSON are missing.
2016-04-16 16:05:24 +00:00
func ErrMissingField ( missingFields ... string ) common . CodeMessager {
return common . ResponseBase {
2016-04-05 20:22:13 +00:00
Code : 422 , // http://stackoverflow.com/a/10323055/5328069
2016-08-15 17:59:46 +00:00
Message : "Missing parameters: " + strings . Join ( missingFields , ", " ) + "." ,
2016-04-05 20:22:13 +00:00
}
}