Skip to content

Suddenly throwing errors #22

@OutOfThisPlanet

Description

@OutOfThisPlanet

Hi clowa,

I had an issue with docker-powershell-core suddenly, after it working for a few days without issue.

I don't think there have been any updates, so it may not be an issue with your project, but I thought I would log it here just in case.

All of a sudden, my scripts were having an issue with "else" blocks, throwing an error:

"else: The term 'else' is not recognized as a name of a cmdlet, function, script file, or executable program."

This occurred when I structure my statements like this:

if (conditions)
{
     #do things
}
else
{
    #do other things
}

The issue didn't occur when the "else" is placed immediately after the previous "}", but only when it was on a new line beneath. I really dislike same-line curly braces and continuing a statement on the same line as another one finishes, so this really bothers me.

I fixed it, of course (I used a back-tick to force pwsh to treat it as part of the same statement block)... but just wanted to flag it in case you come across this issue yourself.

It's just super weird that it suddenly started doing this after running without issue for quite a while.

Cheers!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions