# Line break for the \`error\` word as the function parameter

**URL:** <https://forums.swift.org/t/line-break-for-the-error-word-as-the-function-parameter/56053>\
**Category:** Swift Format\
**Created:** [March 19, 2022, 2:44am UTC](https://forums.swift.org/t/line-break-for-the-error-word-as-the-function-parameter/56053 "2022-03-19T02:44:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![yellow-cap](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/yellow-cap/32/22319_2.png) [@yellow-cap](https://forums.swift.org/u/yellow-cap)\
**Post date:** [March 19, 2022, 2:44am UTC](https://forums.swift.org/t/line-break-for-the-error-word-as-the-function-parameter/56053/1 "2022-03-19T02:44:00Z")

</div>

Hello, guys. Faced with this problem. Swift-format error shown, if I have the line break between the `error` word in the function parameters.

swift-format shows an error:

```swift
   func test(
        error: Error
    ) {
        print("test \(error)")
    }

```

swift-format doesn't show an error

```swift
    func test(error: Error) {
        print("test \(error)")
    }

```

swift-format version: 0.50500.0 Thanks.

---

<div class="post-metadata">

**Author:** ![xwu](https://avatars.discourse-cdn.com/v4/letter/x/b487fb/32.png) [@xwu](https://forums.swift.org/u/xwu)\
**Post date:** [March 19, 2022, 4:18am UTC](https://forums.swift.org/t/line-break-for-the-error-word-as-the-function-parameter/56053/2 "2022-03-19T04:18:49Z")

</div>

What is the error you are referring to?

---

<div class="post-metadata">

**Author:** ![yellow-cap](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/yellow-cap/32/22319_2.png) [@yellow-cap](https://forums.swift.org/u/yellow-cap)\
**Post date:** [March 19, 2022, 4:51am UTC](https://forums.swift.org/t/line-break-for-the-error-word-as-the-function-parameter/56053/3 "2022-03-19T04:51:05Z")

</div>

`Command PhaseScriptExecution emitted errors but did not return a nonzero exit code to indicate failure`

 ![Screenshot 2022-03-19 at 07.58.50](https://global.discourse-cdn.com/swift/original/3X/3/e/3e12144a3d945b33d2e07ef3cdfcaf3e4cef7e5e.png)

---

<div class="post-metadata">

**Author:** ![stackotter](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/stackotter/32/20670_2.png) [@stackotter](https://forums.swift.org/u/stackotter)\
**Post date:** [March 19, 2022, 12:32pm UTC](https://forums.swift.org/t/line-break-for-the-error-word-as-the-function-parameter/56053/4 "2022-03-19T12:32:18Z")

</div>

swift-format seems to be printing out every single file to the console, and Xcode interprets any line starting with `error: ` as an error. That’s kind of funny and unfortunate.

What is the contents of your script phase for running swift format?

---

<div class="post-metadata">

**Author:** ![yellow-cap](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/yellow-cap/32/22319_2.png) [@yellow-cap](https://forums.swift.org/u/yellow-cap)\
**Post date:** [March 19, 2022, 12:37pm UTC](https://forums.swift.org/t/line-break-for-the-error-word-as-the-function-parameter/56053/5 "2022-03-19T12:37:50Z")

</div>

> Xcode interprets any line starting with `error: ` as an error.

Same thoughts.

```swift
if which swift-format >/dev/null; then
    swift-format format -r ${PROJECT_DIR} --configuration .swift-format.json
    swift-format lint -r ${PROJECT_DIR} --configuration .swift-format.json
else
    echo "warning: swift-format not installed"
fi
```

---

<div class="post-metadata">

**Author:** ![allevato](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/allevato/32/385_2.png) [@allevato](https://forums.swift.org/u/allevato)\
**Post date:** [March 19, 2022, 3:53pm UTC](https://forums.swift.org/t/line-break-for-the-error-word-as-the-function-parameter/56053/6 "2022-03-19T15:53:53Z")

</div>

> [@yellow-cap](#):
>
> ```swift
> swift-format format -r ${PROJECT_DIR} --configuration .swift-format.json
> 
> ```

Make sure that you use the [`-i` or `--in-place` flag](https://github.com/apple/swift-format#formatting) on the `format` command to write the output back to the original file, otherwise it gets written to standard output.
