mtien-apache commented on pull request #319:
URL: https://github.com/apache/nifi-registry/pull/319#issuecomment-831591230


   > > Related to my last comment, here are the messages in the error dialogs I 
have found so far:
   > > 
   > > * Non flow definition JSON file: "Cannot create versioned flow snapshot 
- flowContents must not be null"
   > > * Incomplete flow definition JSON file: "Deserialization of uploaded 
JSON failed"
   > > 
   > > It would be great if we could make these error messages more user 
friendly. But that could definitely be done as a separate Jira/PR. I wouldn't 
block this PR to address this.
   
   @andrewmlim I refactored the resource method to let the Spring framework to 
automatically handle the deserialization and removed the "Deserialization of 
uploaded JSON failed" message. 
   
   Agree to improve the error message in a separate PR for the "Cannot create 
versioned flow snapshot - flowContents must not be null" message.
   
   > For the incomplete flow definition JSON file, the error I see now when 
importing is: "Unexpected end-of-input: expected close marker for Object (start 
marker at [Source: 
(org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream);
 line: 1, column: 1]) at [Source: 
(org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream);
 line: 2, column: 1]"
   > 
   > which is more specific to the issue (that there is no closing } in the 
JSON), but less readable.
   
   After investigating this exception message, it seems the exception is being 
caught by an `ExceptionMapper` and translating it to a BadRequest. It may be 
from `jackson-databind` in the Spring framework, which is not something we have 
much control over. It's possible to write a custom ExceptionMapper for a 
BadRequest, but the custom message could end up applying across the app for any 
method throwing that type of Exception, which can be addressed in a separate PR.
   
   Although I agree the error message could be better, it at least points to 
which line the error is found. I believe this is sufficient for the time being. 
Thoughts?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to