Commit e37a643
committed
Improve error message on overlong lines in
This wraps the `fs2.text.LineTooLongException` that is thrown by
`fs2.text.linesLimited` which is used in `process.slurp` to enrich the
error message with more helpful information.
Instead of this:
```
2023-07-19 15:34:45,215 ERROR Steward scala-steward-org/test-repo-1 failed
fs2.text$LineTooLongException: Max line size is 50 but 79 chars have been accumulated
at fs2.text$.$anonfun$linesImpl$1(text.scala:553)
...
```
we now get this:
```
2023-07-19 16:02:41,546 ERROR Steward scala-steward-org/test-repo-1 failed
org.scalasteward.core.io.process$ProcessLineTooLongException: 'mvn --batch-mode dependency:list -DexcludeTransitive=true' outputted a line longer than 50 chars. If the process executed normally and the buffer size is just too small, you can increase it with the --max-buffer-size command-line option and/or open a pull request in https://github.com/scala-steward-org/scala-steward that increases the default buffer size.
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< com.mycompany.app:my-app >----------------------
[INFO] Building my-app 1.0-SNAPSHOT
at org.scalasteward.core.io.process$$anonfun$1.applyOrElse(process.scala:69)
...
Caused by: fs2.text$LineTooLongException: Max line size is 50 but 65 chars have been accumulated
at fs2.text$.$anonfun$linesImpl$1(text.scala:553)
...
```
which includes now
* the command that led to the exception
* the reason why this exception was raised (outputted line is too long)
* guidance how to avoid it
* the output of the process before the exception is raised
* the original exception
This change was motivated by the unhelpful error shown in
scala-steward-org/scala-steward-action#505 (comment).process.slurp
1 parent e034a17 commit e37a643
File tree
2 files changed
+26
-10
lines changed- modules/core/src
- main/scala/org/scalasteward/core/io
- test/scala/org/scalasteward/core/io
2 files changed
+26
-10
lines changedLines changed: 25 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
68 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
69 | 72 | | |
70 | 73 | | |
71 | 74 | | |
| |||
74 | 77 | | |
75 | 78 | | |
76 | 79 | | |
77 | | - | |
| 80 | + | |
78 | 81 | | |
79 | 82 | | |
80 | 83 | | |
| |||
133 | 136 | | |
134 | 137 | | |
135 | 138 | | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
136 | 145 | | |
137 | 146 | | |
138 | 147 | | |
139 | 148 | | |
140 | 149 | | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
| 150 | + | |
146 | 151 | | |
147 | 152 | | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
148 | 165 | | |
149 | 166 | | |
150 | 167 | | |
| |||
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
| |||
47 | 46 | | |
48 | 47 | | |
49 | 48 | | |
50 | | - | |
| 49 | + | |
51 | 50 | | |
52 | 51 | | |
53 | 52 | | |
| |||
0 commit comments