| // Copyright (C) 2016 The Android Open Source Project |
| // |
| // Licensed under the Apache License, Version 2.0 (the "License"); |
| // you may not use this file except in compliance with the License. |
| // You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, software |
| // distributed under the License is distributed on an "AS IS" BASIS, |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| // See the License for the specific language governing permissions and |
| // limitations under the License. |
| |
| package service |
| |
| import ( |
| "fmt" |
| |
| "android.googlesource.com/platform/tools/gpu/framework/binary" |
| "android.googlesource.com/platform/tools/gpu/framework/stringtable/msg" |
| "android.googlesource.com/platform/tools/gpu/gapid/service/path" |
| ) |
| |
| // ErrDataUnavailable is the error raised when the requested data is |
| // unavailable. For instance: the error raised when a framebuffer is |
| // requested at a point in the capture where none is bound. |
| type ErrDataUnavailable struct { |
| binary.Generate `implements:"rpc.Err"` |
| Reason *msg.Msg // The reason the data is unavailable. |
| Transient bool // If true, then making the same request at a later time may result in data. |
| } |
| |
| // ErrInvalidPath is the error raised when the specified path is invalid. |
| // This type of error is permanent. |
| type ErrInvalidPath struct { |
| binary.Generate `implements:"rpc.Err"` |
| Reason *msg.Msg // The description of what's invalid. |
| Path path.Path // The part of the path that was invalid. |
| } |
| |
| // ErrInvalidArgument is the error raised when one of the parameters to an RPC |
| // call is invalid. |
| // This type of error is permanent. |
| type ErrInvalidArgument struct { |
| binary.Generate `implements:"rpc.Err"` |
| Reason *msg.Msg // The description of what's invalid. |
| } |
| |
| func (e *ErrDataUnavailable) Error() string { |
| return "The requested data is unavailable" |
| } |
| |
| func (e *ErrInvalidPath) Error() string { |
| return fmt.Sprintf("The path '%v' is invalid", e.Path) |
| } |
| |
| func (e *ErrInvalidArgument) Error() string { |
| return "The argument is invalid" |
| } |