Skip to content

Swiftly-Use: JSON: Handle no selected toolchain#546

Open
etcwilde wants to merge 1 commit into
swiftlang:mainfrom
etcwilde:ewilde/545-swiftly-use-no-selected-toolchain-json
Open

Swiftly-Use: JSON: Handle no selected toolchain#546
etcwilde wants to merge 1 commit into
swiftlang:mainfrom
etcwilde:ewilde/545-swiftly-use-no-selected-toolchain-json

Conversation

@etcwilde
Copy link
Copy Markdown
Member

Uninstalling all of the tools in Swiftly and printing the current toolchain with swiftly use --format=json results in swiftly printing nothing. This is invalid JSON, so tools like the VSCode extension would emit an error.

Without the fix, the empty JSON passed to the Foundation JSON decoder emits the following error:

Caught error: Error Domain=NSCocoaErrorDomain Code=3840 "Unable to parse empty data." UserInfo={NSDebugDescription=Unable to parse empty data.}

fixes: #545

Uninstalling all of the tools in Swiftly and printing the current
toolchain with `swiftly use --format=json` results in swiftly printing
nothing. This is invalid JSON, so tools like the VSCode extension would
emit an error.

Without the fix, the empty JSON passed to the Foundation JSON decoder
emits the following error:

```
Caught error: Error Domain=NSCocoaErrorDomain Code=3840 "Unable to parse empty data." UserInfo={NSDebugDescription=Unable to parse empty data.}
```

Fixes: swiftlang#545
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invalid JSON emitted from swiftly use --format=json with no installed or selected toolchains

2 participants