code.vegaprotocol.io/vega@v0.79.0/wallet/service/v2/response.go (about) 1 // Copyright (C) 2023 Gobalsky Labs Limited 2 // 3 // This program is free software: you can redistribute it and/or modify 4 // it under the terms of the GNU Affero General Public License as 5 // published by the Free Software Foundation, either version 3 of the 6 // License, or (at your option) any later version. 7 // 8 // This program is distributed in the hope that it will be useful, 9 // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 // GNU Affero General Public License for more details. 12 // 13 // You should have received a copy of the GNU Affero General Public License 14 // along with this program. If not, see <http://www.gnu.org/licenses/>. 15 16 package v2 17 18 type Response struct { 19 // Result is REQUIRED on success. This member MUST NOT exist if there was an 20 // error invoking the method. 21 Result Result `json:"result,omitempty"` 22 23 // Error is REQUIRED on error. This member MUST NOT exist if there was no 24 // error triggered during invocation. 25 Error *ErrorDetails `json:"error,omitempty"` 26 } 27 28 // Result is just a nicer way to describe what's expected to be returned by the 29 // handlers. 30 type Result interface{} 31 32 // ErrorDetails is returned when an HTTP call encounters an error. 33 type ErrorDetails struct { 34 // Message provides a short description of the error. 35 // The message SHOULD be limited to a concise single sentence. 36 Message string `json:"message"` 37 38 // Data is a primitive or a structured value that contains additional 39 // information about the error. This may be omitted. 40 // The value of this member is defined by the Server (e.g. detailed error 41 // information, nested errors etc.). 42 Data string `json:"data,omitempty"` 43 }