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 single message path #48
Conversation
|
||
public ExpiredMessageException(Message messageWithRequestedId, LocalDateTime asOfWhen) { | ||
super("Message with id [" + messageWithRequestedId.getId() + "] is expired as of " + asOfWhen | ||
.toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This exception will throw an exception if asOfWhen is null
src/main/resources/messages.json
Outdated
"description": "This announcement is not live. Too soon..", | ||
"descriptionShort": "Premature.", | ||
"messageType": "announcement", | ||
"goLiveDate": "2999-01-01", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will fail with the new refactored filter structure. Let's merge #49 first, and then fix this with the new structure.
Intend to, in a new branch off of Pushed the new |
Could the new custom exceptions be checked Exceptions rather than RuntimeExceptions? Runtime exceptions lead to not so funtime surprises. |
I'm willing to give on this, but I thought (Discussed f2f. Team consensus is regardless of whether (This is one of those moments where I'm entirely convinced I'm right to use |
Reduce duplication between README and Controller, reduce likelihood of their getting out of sync.
c97c031
to
8b45401
Compare
Adds paths for viewing just one message, identified by id.
/admin/message/{id}
will view the message regardless of audience/message/{id}
will view the message iff the message is available in the context of the request (so, considering who is asking, current date vs begin and end dates, etc.)Why? To bootstrap idiomatic error handling in this Spring Boot microservice, namely
404 NOT FOUND
403 FORBIDDEN
What this demonstrates:
Controller returning(Not true! Moral of story is always ensure your unit test fails before it succeeds, otherwise maybe you forgot tonull
automagically is404 NOT FOUND
.@Test
annotate, as I did.)500
unless the exception is annotated (as the custom exceptions here are), then it's whatever the annotation said (here,403 FORBIDDEN
or404 NOT FOUND
).Tradeoffs navigated
Explored not using Exceptions to model errors out of the
Controller
layer. That wasn't much fun. SpringWebMVC really "wants" to use annotated Exceptions for this.Contributor License Agreement adherence:
Definition of Done