-
Notifications
You must be signed in to change notification settings - Fork 152
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
feat: add global exception catching #1256
Comments
Hi @wamynobe 👋 ! I'm curious to know if you have a proposal on how this should be done 👀, for example, do you have an API in mind? |
Hi @alestiago . I have some ideals. void main() async {
entrypoint.bootstrap(
() async {
final address = InternetAddress.tryParse('{{{host}}}') ?? InternetAddress.anyIPv6;
final port = int.tryParse(Platform.environment['PORT'] ?? '{{{port}}}') ?? {{{port}}};{{#invokeCustomInit}}
await entrypoint.init(address, port);{{/invokeCustomInit}}
hotReload(() => createServer(address, port));
}
);
} Can we add a bootstrap function in custom main file? void bootstrap(void Function() callback) async{
runZonedGuarded(
() => callback.call(),
(error, stack) {
// I want to log the error here
log('Error: $error');
},
);
} Or if you want to use SentrySDK for dart you can go like void bootstrap(void Function() callback) async{
await Sentry.init(
(options) {
options.dsn = 'https://[email protected]/example';
},
appRunner: callback,
);
} That's all! |
I am trying to figure out how to use Mason and how to customize these bricks. I want to check my ideal but I have not found a way to custom dart_frog_dev_server yet. |
I checked dart_frog_dev_server brick but I have no ideal how to modify this file because of the line "// GENERATED CODE - DO NOT MODIFY BY HAND". I'm confused! |
@wamynobe thank you for taking an initiative here 💙 . There is a CONTRIBUTING guide for updating Dart Frog CLI. There is no CONTRIBUTING guide for the bricks. I think we should have one. I may be able to provide one, however, you might have to bear with me, since I have other tasks with greater priority. In terms of moving forward and adding global exception catching, it needs to be discussed with the team and evaluated. In the meantime, if you would like to work on a proof of concept, please do! |
@alestiago Thank you for the instructions. I can now edit the server.dart file and it works as I expected. Thanks for pointing out the contribute section in the cli. I honestly overlooked it when trying to modify bricks and bundles. Regarding this issue, after discussing with the team, if there is anything I can help with, please ask! |
Description
Clearly describe what you are looking to add. The more context the better.
Requirements
Additional Context
Add any other context or screenshots about the feature request go here.
The text was updated successfully, but these errors were encountered: