Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

fixed issue 1716: No third party error handling in loading plugin RES… #1717

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mgmt/rest/v2/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ func (s *apiV2) GetRoutes() []api.Route {
// 415: ErrorResponse
// 500: ErrorResponse
// 401: UnauthResponse
// default: ErrorStringResponse
api.Route{Method: "POST", Path: prefix + "/plugins", Handle: s.loadPlugin},
// swagger:route DELETE /plugins/{ptype}/{pname}/{pversion} plugins unloadPlugin
//
Expand Down
9 changes: 9 additions & 0 deletions mgmt/rest/v2/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@ type UnauthError struct {
Message string `json:"message"`
}

// ErrorStringResponse represents an error in the string format.
//
// It includes an error message only.
//
// swagger:response ErrorStringResponse
type ErrorStringResponse struct {
Message string `json:"message"`
}

// Unsuccessful generic response to a failed API call
type Error struct {
ErrorMessage string `json:"message"`
Expand Down
11 changes: 11 additions & 0 deletions swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@
},
"500": {
"$ref": "#/responses/ErrorResponse"
},
"default": {
"$ref": "#/responses/ErrorStringResponse"
}
}
}
Expand Down Expand Up @@ -1292,6 +1295,14 @@
"$ref": "#/definitions/Error"
}
},
"ErrorStringResponse": {
"description": "ErrorStringResponse represents an error in the string format.\n\nIt includes an error message only.",
"headers": {
"message": {
"type": "string"
}
}
},
"MetricsResponse": {
"description": "MetricsResponse is the representation of metric operation response.",
"schema": {
Expand Down