Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normalize log response #8

Open
tortillaj opened this issue Nov 13, 2016 · 0 comments
Open

Normalize log response #8

tortillaj opened this issue Nov 13, 2016 · 0 comments

Comments

@tortillaj
Copy link

tortillaj commented Nov 13, 2016

The GET stream method sometimes returns JSON and sometimes returns plain text. This makes it more tedious to handle responses.

If a log is not found, JSON is returned where the error property is a string: https://github.com/ProboCI/loom/blob/master/lib/api/controllers/index.js#L136

If a log is found, the plain text log is sent back:
https://github.com/ProboCI/loom/blob/master/lib/api/controllers/index.js#L153

If there is an exception or other error, JSON is returned where the error property is limited to only the exception error message:
https://github.com/ProboCI/loom/blob/master/lib/api/controllers/index.js#L19

Proposal - All responses return JSON, leaving properties empty that do not exist for the given response:

{
  error: exception or null, 
  errorMessage: error text (placed here separately in case there is no exception object), 
  log: log text or empty string
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant