Raise MissingAttributeError with explicit message
What does this MR do and why?
Raise MissingAttributeError with explicit message
- Previously when encountering a MissingAttributeError on audit audit events you were left trying to find out what exactly was missing. This MR improves the developer experience by directly showing you what you need to provide.
Screenshots or screen recordings
AuditEvents::BuildService.new(author: nil, scope: scope_thing, target: target_thing, message: 'audit me')
Before | After |
---|---|
AuditEvents::BuildService::MissingAttributeError |
AuditEvents::BuildService::MissingAttributeError: author |
How to set up and validate locally
Example below:
- In rails console:
author_thing = User.first scope_thing = Project.first target_thing = User.first message_thing = "A message" AuditEvents::BuildService.new(author: author_thing, scope: scope_thing, target: target_thing, message: message_thing)
- Change any of the
[...]_thing
vairalbes tonil
and rerun the last line. - Verify it raises the (first)
nil
attribute
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.