Skip to content

Commit fb8dcf0

Browse files
committed
makes the MethodChannel Error get vet complient
1 parent b05ece9 commit fb8dcf0

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

plugin/method-channel.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ func (m *MethodChannel) handleMethodCall(handler MethodHandler, methodName strin
213213

214214
var errorCode string
215215
switch t := err.(type) {
216-
case *PluginError:
216+
case *Error:
217217
errorCode = t.code
218218
default:
219219
errorCode = "error"
@@ -233,22 +233,22 @@ func (m *MethodChannel) handleMethodCall(handler MethodHandler, methodName strin
233233
responseSender.Send(binaryReply)
234234
}
235235

236-
// This error can be thrown from a go-flutter plugin. Useful if
236+
// Error This error can be thrown from a go-flutter plugin. Useful if
237237
// you are interested in returning custom error codes.
238-
// If that is not the case, you can just throw normal Go 'error's
239-
type PluginError struct {
238+
// If that is not the case, you can just throw normal Go 'error's.
239+
type Error struct {
240240
err string
241241
code string
242242
}
243243

244-
// Needed to comply with the Golang 'error' interface
245-
func (e *PluginError) Error() string {
244+
// Error is needed to comply with the Golang 'error' interface.
245+
func (e *Error) Error() string {
246246
return e.err
247247
}
248248

249-
// Create an error with an specific error code
250-
func NewPluginError(code string, err error) *PluginError {
251-
pe := &PluginError{
249+
// NewError create an error with an specific error code.
250+
func NewError(code string, err error) *Error {
251+
pe := &Error{
252252
code: code,
253253
err: err.Error(),
254254
}

0 commit comments

Comments
 (0)