-
Notifications
You must be signed in to change notification settings - Fork 12
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
Clarify error handling expectations #46
Comments
Thanks for filing the issue. We might want to take these one by one. Some of the behavior may purposefully be undefined and custom per language and some might be legacy code form the internal invoker. Nonetheless, we should provide more guidance on each of these bullets around error handling. |
Handling In general, each language has a different server implementation that gives some variability. Nonetheless, given a more concrete list of possible errors, we could document the expected error message and status codes in this contract. CC: @asriniva |
Specifically talking about the |
Assigning to @anniefu per request. |
Unfortunately, the frameworks themselves are pretty scattered on HTTP code usage, and additionally underlying web frameworks in each language may be returning different codes for different cases. Due to that, it is difficult to establish any hard guidelines for errors at this point. Function ErrorsThere are some enforced principles for the case when the user function itself errors that are important to maintain for privacy and security reasons:
System ErrorsFor "system" errors coming from the Functions Framework or underlying HTTP frameworks, there are no hard guidelines, but this would be my recommendation:
Not required, but the framework must follow the above guidelines for handing user function errors
May be highly dependent on the language. Prefer detailed error messages, especially if the error is a user error that can is fixable. Only include system error information, do not include error messages from user function (log those instead).
Use exactly Prefer using the error message to differentiate error cases instead of the HTTP code.
Stack traces are not required, but can be very helpful. They should be logged instead of included in response bodies. |
In #15 a set of typical HTTP response codes was documented, however, in working on the PHP functions framework we have found there's a lot that remains undefined in how errors should be handled.
GoogleCloudPlatform/functions-framework-php#60 demonstrates the only definition is triangulating against the behaviors of other functions frameworks, which include some behaviors in the name of backwards compatibility that are not intended as part of the functions framework specification.
Actual
Each language makes independent decisions around error handling, including:
X-Google-Status
custom HTTP headerExpected
Functions frameworks provide a consistent experience in surfacing errors such as HTTP Functions and CloudEvent Functions present a language agnostic programming paradigm for service-to-service communications.
The text was updated successfully, but these errors were encountered: