Skip to content

Custom error codes on the plugin side #238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 22, 2019

Conversation

davidmartos96
Copy link
Contributor

@davidmartos96 davidmartos96 commented Aug 22, 2019

There are Flutter plugins that use custom error codes when returning to the Dart side.
For instance, Sqflite here.
It is a non breaking change.

I created another PR using this feature in the examples repo. #28

P.S: I tested it with go-flutter master as base since in beta it gives me the following error in my machine.

# github.com/go-flutter-desktop/go-flutter/embedder
/usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld: $WORK/b037/_x003.o: in function `_cgo_3e7fb0d74f06_Cfunc_FlutterPlatformMessageReleaseResponseHandle':
/tmp/go-build/cgo-gcc-prolog:252: undefined reference to `FlutterPlatformMessageReleaseResponseHandle'
/usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld: $WORK/b037/_x005.o: in function `createMessageResponseHandle':
../../../go-flutter/embedder/embedder_helper.c:73: undefined reference to `FlutterPlatformMessageCreateResponseHandle'
collect2: error: ld returned 1 exit status
hover: Updating go-flutter to latest version failed: exit status 2

Copy link
Member

@pchampio pchampio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very, very good!
Add some doc about the exported func and it will be good to go!


P.S: I tested it with go-flutter master as base since in beta it gives me the following error in my machine.

What is your flutter beta version?, on Flutter 1.8.3 • channel beta the reference to FlutterPlatformMessageReleaseResponseHandle is available in the engine.

@@ -223,3 +232,20 @@ func (m *MethodChannel) handleMethodCall(handler MethodHandler, methodName strin
}
responseSender.Send(binaryReply)
}

type PluginError struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add comment describing what PluginError|Error|NewPluginError are for. (make golint happy)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Drakirus Ok, I added some docs.

@davidmartos96
Copy link
Contributor Author

@Drakirus

What is your flutter beta version?, on Flutter 1.8.3 • channel beta the reference to FlutterPlatformMessageReleaseResponseHandle is available in the engine.

Alright, I was using the wrong flutter binary. Thanks!

@pchampio
Copy link
Member

get vet output:
type name will be used as plugin.PluginError by other packages, and that stutters; consider calling this Error

@davidmartos96
Copy link
Contributor Author

@Drakirus I didn't know about vet. Thanks for pointing out.

@pchampio
Copy link
Member

pchampio commented Aug 22, 2019

FYI, read https://blog.golang.org/godoc-documenting-go-code
The first word on the godoc sentence must be the type, variable, constant, function.

@pchampio pchampio force-pushed the custom_error_codes branch from fb8dcf0 to 05830cb Compare August 22, 2019 13:55
@pchampio pchampio merged commit f572274 into go-flutter-desktop:beta Aug 22, 2019
@pchampio
Copy link
Member

Thank for your contribution! 👍

@davidmartos96
Copy link
Contributor Author

You are welcome. Thank you for your work!

@GeertJohan
Copy link
Member

Great addition!

pchampio added a commit that referenced this pull request Sep 3, 2019
* Texture support (#217)

* Feature/event loop interop (#218)

* Feature/callback messages (#220)

* fix: remove initial WaitEvent

now that we have implemented the proper event loop.
Delete the first WaitEvent

* lazy initialize go-gl/gl on first texture frame

* align BinaryMessenger with *-channels

BinaryMessenger:
SendNoReply -> Send
Send -> SendWithReply

* change the priorityQueue to specifically contain embedder.FlutterTask's

* Adds comments and renames internals. Also some re-ordering of init code. (#235)

* Addressing comments & fix pointer warning

* implement RunOnCurrentThread check using C call

* Custom error codes on the plugin side (#238)

Custom error codes on the plugin side

* rely on LockOSThread to ensure engine task are run on the same thread
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants