[NETCONF-964] YangLib returns a 500 error if the requested SchemaSource is not available Created: 10/Feb/23  Updated: 06/Jun/23  Resolved: 06/Jun/23

Status: Resolved
Project: netconf
Component/s: netconf, restconf-nb
Affects Version/s: None
Fix Version/s: 6.0.0

Type: Improvement Priority: Medium
Reporter: Peter Suna Assignee: Šimon Ukuš
Resolution: Done Votes: 0
Labels: pt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File after-patch-1.png     PNG File after-patch-2.png     PNG File original.png    

 Description   

If a request is made to display a YANG model that is not loaded or if the request contains a typo, YangLib returns a 500 error instead of a useful response.

The YangLibProvider handles this scenario by throwing an IllegalStateException with a message. This exception can be used in a way that results in a correct response.



 Comments   
Comment by Ivan Hrasko [ 02/Mar/23 ]

PeterSuna "This exception can be used in a way that results in a correct response." What do you mean by "correct" response?

Comment by Peter Suna [ 02/Mar/23 ]

Instead of throwing IllegalStateException exception, used one of those:
https://dennis-xlc.gitbooks.io/restful-java-with-jax-rs-2-0-2rd-edition/content/en/part1/chapter7/exception_handling.html

Comment by Šimon Ukuš [ 31/May/23 ]

Original

After 1st patch https://git.opendaylight.org/gerrit/c/netconf/+/105867

After 2nd patch https://git.opendaylight.org/gerrit/c/netconf/+/106300

Generated at Wed Feb 07 20:16:21 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.