Skip to content

"appendToResults" brokes when receives undefined in param "res" #457

Open
@nicacioliveira

Description

@nicacioliveira

We facing an issue with dry-run mode when all times when the repository plugin returns an undefined value, the function appendToResults is broken because the command flat of javascript could not be applied in an undefined value or value different of an array.

Line that brokes

this.appendToResults(res)

I can write the correction and open one PR, but I opening this issue to check with you folks if it makes sense.
One simple solution is one check if the value passed in appendToResults is an array, basically.

Evidence:

TypeError: Cannot read property 'flat' of undefined     at Settings.appendToResults (/opt/safe-settings/lib/settings.js:666:46)     at /opt/safe-settings/lib/settings.js:227:16     at runNextTicks (internal/process/task_queues.js:60:5)     at listOnTimeout (internal/timers.js:526:9)     at processTimers (internal/timers.js:500:7)     at async Promise.all (index 256)     at async Function.syncSubOrgs (/opt/safe-settings/lib/settings.js:21:5)     at async Promise.all (index 0)     at async Promise.all (index 0)     at async middleware (/opt/safe-settings/node_modules/@octokit/webhooks/dist-node/index.js:355:5)
--

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