// Error returns the error's message body.
// The result's first letter is lowercase when the above rule is applied
// and it never ends with examination points '.' or '!'.
Error returns the error's message body.
The result's first letter is lowercase when the above rule is applied
and it never ends with examination points '.' or '!'.
// Error returns the error ' s message body . // The result ' s first letter is lowercase when the above rule is applied // and it never ends with examination points ' . ' or ' ! ' .
func (err ResourceError) Error() string {
	chars := []rune(err.Body)
	length := len(chars)
	if length <= 1 {
		return strings.ToLower(err.Body)
	}
	firstChar, secondChar := chars[0], chars[1]
	if shouldLowercase := unicode.IsLetter(firstChar) && unicode.IsLetter(secondChar) && unicode.IsLower(secondChar); shouldLowercase {
		chars[0] = unicode.ToLower(firstChar)
	}
	if length > 2 {
		switch chars[length-1] {
		case '.', '!':
			chars = chars[0 : length-1]
		}
	}
	return string(chars)
}
func ( err ResourceError ) Error ( ) string { chars := [ ] rune ( err . Body ) length := len ( chars ) if length <= 1 { return strings . ToLower ( err . Body ) } firstChar , secondChar := chars [ 0 ] , chars [ 1 ] if shouldLowercase := unicode . IsLetter ( firstChar ) && unicode . IsLetter ( secondChar ) && unicode . IsLower ( secondChar ) ; shouldLowercase { chars [ 0 ] = unicode . ToLower ( firstChar ) } if length > 2 { switch chars [ length - 1 ] { case '.' , '!' : chars = chars [ 0 : length - 1 ] } } return string ( chars ) }
Error returns the error's message body.
Error returns the error ' s message body .
// check for second first second chars as letters before lowercase the first one: // if it's uppercase then skip the force-lowercase of the first letter of the error body, // no need to check for status code or the whole word or the last letter of the word(<-at least as we know so far). // check the size because the examination point may be a critical part of that small error, // although currently we don't have an error like that at all.