github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/obs/error.go (about)

     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  
    13  package obs
    14  
    15  import (
    16  	"encoding/xml"
    17  	"fmt"
    18  )
    19  
    20  // ObsError defines error response from OBS
    21  type ObsError struct {
    22  	BaseModel
    23  	Status   string
    24  	XMLName  xml.Name `xml:"Error"`
    25  	Code     string   `xml:"Code" json:"code"`
    26  	Message  string   `xml:"Message" json:"message"`
    27  	Resource string   `xml:"Resource"`
    28  	HostId   string   `xml:"HostId"`
    29  }
    30  
    31  func (err ObsError) Error() string {
    32  	return fmt.Sprintf("obs: service returned error: Status=%s, Code=%s, Message=%s, RequestId=%s",
    33  		err.Status, err.Code, err.Message, err.RequestId)
    34  }