Skip to content
This repository has been archived by the owner on Mar 8, 2020. It is now read-only.

Response have an error status but UAST also #77

Closed
zurk opened this issue May 11, 2018 · 4 comments
Closed

Response have an error status but UAST also #77

zurk opened this issue May 11, 2018 · 4 comments

Comments

@zurk
Copy link

zurk commented May 11, 2018

I am not sure if it correct behavior or not, but for this file:
4132.txt (it is java code)
and python code to run:

import bblfsh
bf = bblfsh.BblfshClient("0.0.0.0:9432")
print(bf.parse(taskpath, language="Java"))

I have:

status: ERROR
errors: "Syntax error on tokens, delete these tokens"
elapsed {
  nanos: 40917102
}
uast {
  internal_type: "CompilationUnit"
  children {

...

  roles: FILE
}
language: "java"

there is full UAST inside.

so is UAST not valid or is it wrong status inside the response?

@zurk
Copy link
Author

zurk commented May 11, 2018

update: it is not correct Java code.

@dennwc
Copy link
Member

dennwc commented May 11, 2018

The response looks valid to me. There are 3 statuses: OK, Error and Fatal. Error means that driver was able to process a part of the file, but there might be some syntax errors, thus the AST, in this case, might be incomplete. Fatal on the other hand would mean that driver fail completely.

For user applications, I would suggest accepting AST only for OK status codes because right now there is no guarantee on how complete an AST would be on Error (it might be empty for some drivers).

@bzz
Copy link
Contributor

bzz commented May 14, 2018

For user applications, I would suggest accepting AST only for OK status codes because right now there is no guarantee on how complete an AST would be on Error (it might be empty for some drivers).

@dennwc do you think it could be helpful then to document this suggestion somewhere in the official docs of the bblfsh project?

I find error reporting not very straightforward at all, and we already might have number of users of bblfsh clients, treat this situation in a different fashion.

@dennwc
Copy link
Member

dennwc commented May 14, 2018

@bzz @zurk I'm closing this in favor of bblfsh/sdk#257, since it's not Java-related.

@dennwc dennwc closed this as completed May 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants