You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

error.go 1.2 kB

4 years ago
1234567891011121314151617181920212223242526272829303132333435
  1. // Copyright 2019 Huawei Technologies Co.,Ltd.
  2. // Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  3. // this file except in compliance with the License. You may obtain a copy of the
  4. // License at
  5. //
  6. // http://www.apache.org/licenses/LICENSE-2.0
  7. //
  8. // Unless required by applicable law or agreed to in writing, software distributed
  9. // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
  10. // CONDITIONS OF ANY KIND, either express or implied. See the License for the
  11. // specific language governing permissions and limitations under the License.
  12. //nolint:golint, unused
  13. package obs
  14. import (
  15. "encoding/xml"
  16. "fmt"
  17. )
  18. // ObsError defines error response from OBS
  19. type ObsError struct {
  20. BaseModel
  21. Status string
  22. XMLName xml.Name `xml:"Error"`
  23. Code string `xml:"Code" json:"code"`
  24. Message string `xml:"Message" json:"message"`
  25. Resource string `xml:"Resource"`
  26. HostId string `xml:"HostId"`
  27. }
  28. func (err ObsError) Error() string {
  29. return fmt.Sprintf("obs: service returned error: Status=%s, Code=%s, Message=%s, RequestId=%s",
  30. err.Status, err.Code, err.Message, err.RequestId)
  31. }