Skip to content

Normalize log response #8

Description

@tortillaj

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
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions