[MGNLREST-144] Delivery endpoint should return 4** codes for non-existant resource or entities Created: 06/Nov/17  Updated: 19/Dec/17  Resolved: 29/Nov/17

Status: Closed
Project: Magnolia REST Framework
Component/s: None
Affects Version/s: None
Fix Version/s: 2.0.1

Type: Bug Priority: Major
Reporter: Christopher Zimmermann Assignee: Hieu Nguyen Duc
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: 5h
Time Spent: 1d 3h
Original Estimate: 2d

Issue Links:
dependency
depends upon MGNLREST-97 Implement exception handling for rest... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:
Epic Link: REST Phase2
Sprint: Saigon 123, Saigon 124
Story Points: 3

 Description   

Currently the delivery returns a 500 error code when it should return a 4** type error code when the client is attempting to reference a delivery endpoint or entity that does not exist.
Also, the response should not mention the RESTEASY library.
It also seems strange that this results in an exception in the log - is this desired behaviour?

To reproduce missing resource:
Request: http://localhost:8080/magnoliaAuthor/.rest/delivery/fdjsk

Result:
500 response code.
Response body: "RESTEASY003210: Could not find resource for full path: http://localhost:8080/magnoliaAuthor/.rest/delivery/fdjsk"
Exception and stack trace in log
The system should not return RESTEASY in a response as this is an implementation detail and should not be exposed to clients.

To reproduce missing entity:
Request: localhost:8080/magnoliaAuthor/.rest/delivery/tours/v1/magnolia-travels/A-Taste-of-Malaysia2

Result
500 response code
Response body: /magnolia-travels/A-Taste-of-Malaysia2
Exception and stack trace in log


In general 4** response codes should be used whenever the client makes an error in the request, and 500 should be used when the server/system is malfunctioning / overloaded.



 Comments   
Comment by Dai Ha [ 01/Dec/17 ]

verify with bundle: magnolia-community-demo-bundle-5.6.1-20171130.140724-13-tomcat-bundle.zip
not found resources/entities now return 404:
http://localhost:8080/magnoliaAuthor/.rest/delivery/fdjsk
code: 404
localhost:8080/magnoliaAuthor/.rest/delivery/website/v1/travel/footer/footer2/011111
code: 404

Generated at Mon Feb 12 06:57:02 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.