Skip to content

If the sematext api returns a 400 (missing API token, for example), the library throws an error #24

@antony

Description

@antony

This was the root cause which prompted me to consider #22

The library attempts to parse the body of every response from sematext without first checking that the overall request was successful.

The issue is on this line: https://github.com/sematext/logsene-js/blob/master/index.js#L528

The library should first check that the response is within the 200 > 299 range, and perhaps even then, safely check if res.body.items exists before trying to iterate it.

Additionally, mutating the response object here https://github.com/sematext/logsene-js/blob/master/index.js#L515 is not a great idea and should probably be assigned to a new variable.

I'll fix this as part of the work for #22

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions