[MGNLREST-97] Implement exception handling for rest endpoint Created: 21/Aug/17  Updated: 22/Jan/18  Resolved: 06/Jan/18

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

Type: Task Priority: Neutral
Reporter: Sang Ngo Huu Assignee: Hieu Nguyen Duc
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: 0d
Time Spent: 9d 3h
Original Estimate: 4d

Issue Links:
dependency
is depended upon by MGNLREST-141 properties endpoint throws 400 for ev... Open
is depended upon by MGNLREST-132 Response includes JCR query error if ... Closed
is depended upon by MGNLREST-144 Delivery endpoint should return 4** c... Closed
is depended upon by DOCU-2231 DOC: properties endpoint throws 400 f... Closed
relation
is related to MGNLREST-79 Provide error messages for REST calls... Closed
Template:
Acceptance criteria:
Empty
Task DoR:
Empty
Date of First Response:
Epic Link: REST Phase2
Sprint: Saigon 121, Saigon 122, Saigon 125, Saigon 126, Saigon 127, Saigon 128, Saigon 129, Saigon 130
Story Points: 5

 Description   

Following up on MGNLREST-93, we first aim at reviewing exception handling (ExceptionMapper) for JCR & Magnolia exceptions.

As a secondary goal, we might as well consider carrying metadata in the body of error responses (how much? only when magnolia.develop is true?)



 Comments   
Comment by Mikaël Geljić [ 06/Nov/17 ]

First come up with a concept;

  • Evaluate whether our current ExceptionMapper being generically typed to all Throwables makes sense
  • how more specific can we be
  • can we provide meaningful mappings between exceptions and HTTP status codes
  • current ExceptionMapper overrides RESTEasy's default one
  • therefore standard JAX-RS exceptions don't get treated with appropriate status atm
    • e.g.
      NotFoundException normally yields a 404;
    • every exception yields a 500
    • maybe even including those intended bad-requests

Check out linked tickets as well;

Comment by Hieu Nguyen Duc [ 07/Nov/17 ]

mgeljic Here is the discussion about the above ideas. Please review it.
https://wiki.magnolia-cms.com/display/VN/2017-11-07+REST+Exception+Handling

Comment by Hieu Nguyen Duc [ 17/Nov/17 ]

Wiki has been updated for the "facts". MGNLREST-144 and MGNLREST-132 are taken into consideration.

Comment by Christopher Zimmermann [ 20/Nov/17 ]

Please also see interesting partners notes on : MGNLREST-79

Comment by Hieu Nguyen Duc [ 12/Dec/17 ]

Currently legacy endpoints are returning error response as plain text which is not a good practice.
Maintaining backward compatibility of this plain text seems heavy and unworthy because customers are likely not to use plain text from that error response. We've ended up with changing the format from plain text to what user is requesting for. For example, if user requests for XML, the error response will be XML. If "Accept" header is not specified, the error response will be formatted as JSON by default.

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