Skip to content

Commit

Permalink
Merge pull request #123 from NerdJeremia/Add-ApiErrorable-interface
Browse files Browse the repository at this point in the history
add ApiErrorable interface
  • Loading branch information
baywet authored Nov 22, 2023
2 parents 47652f8 + adff5e8 commit edbb11f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

## [1.5.2] - 2023-11-22

### Added

- Added ApiErrorable interface. [microsoft/kiota-http-go#110](https://github.com/microsoft/kiota-http-go/issues/110)

## [1.5.1] - 2023-11-15

### Added
Expand Down
13 changes: 13 additions & 0 deletions api_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ package abstractions

import "fmt"

type ApiErrorable interface {
SetResponseHeaders(ResponseHeaders *ResponseHeaders)
SetStatusCode(ResponseStatusCode int)
}

// ApiError is the parent type for errors thrown by the client when receiving failed responses to its requests
type ApiError struct {
Message string
Expand All @@ -21,3 +26,11 @@ func (e *ApiError) Error() string {
func NewApiError() *ApiError {
return &ApiError{ResponseHeaders: NewResponseHeaders()}
}

func (e *ApiError) SetResponseHeaders(ResponseHeaders *ResponseHeaders) {
e.ResponseHeaders = ResponseHeaders
}

func (e *ApiError) SetStatusCode(ResponseStatusCode int) {
e.ResponseStatusCode = ResponseStatusCode
}

0 comments on commit edbb11f

Please sign in to comment.