Skip to content
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: include object id/key in invalid object errors #301

Merged

Conversation

stoneman
Copy link
Contributor

@stoneman stoneman commented May 19, 2022

Summary

  • Include object id/key in errors when objects not found in datafile
  • Modifies invalid object id/key log messages to make them consistent

Include object id/key in errors when an object is not found makes them available to the user or the custom error handler.

One example of why this is useful is that the key of an experiment could be used within a custom error handler to fetch the details of the experiment. This would indicate whether the experiment has been paused (in which case the error could be ignored) or archived (in which case the code referencing the experiment should be removed from the application).

This change will impact existing custom error handlers which are expecting an error class rather than an error object instance.

Test plan

Jira ticket:
https://jira.sso.episerver.net/browse/FSSDK-9439

@stoneman stoneman requested a review from a team as a code owner May 19, 2022 11:12
@stoneman stoneman force-pushed the stoneman/include-identifiers-in-errors branch from c035384 to b8093b1 Compare May 19, 2022 11:12
- Include object `id`/`key` in errors when objects not found in datafile
- Modifies invalid object `id`/`key` log messages to make them consistent

Include object `id`/`key` in errors when an object is not found makes them available to the user or the custom error handler.

One example of why this is useful is that the `key` of an experiment could be used within a custom error handler to fetch the details of the experiment. This would indicate whether the experiment has been paused (in which case the error could be ignored) or archived (in which case the code referencing the experiment should be removed from the application).
@stoneman stoneman force-pushed the stoneman/include-identifiers-in-errors branch from b8093b1 to 06209f7 Compare May 19, 2022 11:13
- Expose the object identifiers as error properties so that they are easier to use in error handlers.
- Encapsulate the error messages within the error objects to enforce consistency and to simplify initialization
- Use the messages of the error objects as log messages to enforce consistency and to simplify logging
@mikechu-optimizely
Copy link
Contributor

We're super late on looking at this @stoneman. Sorry about that.

Is this change still relevant?

lib/optimizely/exceptions.rb Outdated Show resolved Hide resolved
lib/optimizely/exceptions.rb Outdated Show resolved Hide resolved
@Mat001 Mat001 mentioned this pull request Sep 29, 2023
@Mat001
Copy link
Contributor

Mat001 commented Sep 29, 2023

@stoneman I have your PR working and ready to be merged. Would you mind signing this license form please so we can merge?
https://docs.google.com/a/optimizely.com/forms/d/e/1FAIpQLSf9cbouWptIpMgukAKZZOIAhafvjFCV8hS00XJLWQnWDFtwtA/viewform

@stoneman
Copy link
Contributor Author

@Mat001 signed! :)

@Mat001 Mat001 merged commit 9b77a5b into optimizely:master Oct 10, 2023
4 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants