Skip to content

Commit 2175ed9

Browse files
committed
docs: document the corrective facts in CLI diagnostics
1 parent 75f9d0e commit 2175ed9

3 files changed

Lines changed: 23 additions & 16 deletions

File tree

‎README.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,9 @@ A relative `--config` value is resolved against the directory the command is
8484
run in, while the relative paths inside the file stay relative to the file's own
8585
directory. `generate` exits with status `0` on success, and with status `1`
8686
after printing one diagnostic for invalid configuration, an unreadable source, a
87-
query it cannot compile, an output directory or file it cannot write, a stale
88-
generated file it cannot delete, or an output manifest it cannot read or write.
87+
schema it cannot parse, a query it cannot compile, an output directory or file
88+
it cannot write, a stale generated file it cannot delete, or an output manifest
89+
it cannot read or write.
8990

9091
## Getting started
9192

‎docs/configuration.md‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -289,17 +289,21 @@ sqlcj: Generated file paths for repositories 'UserData' and 'Userdata' differ on
289289

290290
Invalid configuration, unreadable SQL sources, and output that cannot be written
291291
or cleaned up make `sqlcj generate` print a single message on standard error and
292-
exit with a non-zero status. The message names the configuration file and, when
293-
available, the offending field, value, source path, or output path:
292+
exit with status `1`. The message names the configuration file and, when
293+
available, the offending field, value, source path, or output path, and ends
294+
with the fact that explains the failure, such as the reason the filesystem
295+
reports or the problem the YAML parser reports with its line and column:
294296

295297
```text
298+
sqlcj: Cannot read configuration file: /home/dev/project/sqlcj.yaml: No such file or directory
299+
sqlcj: Malformed configuration file: /home/dev/project/sqlcj.yaml: expected <block end>, but found '<block mapping start>' at line 2, column 3
296300
sqlcj: Invalid configuration in /home/dev/project/sqlcj.yaml: 'java.package' value 'dev.class.generated' is not a valid Java package name
297-
sqlcj: Cannot read queries source: /home/dev/project/sql/missing.sql
298-
sqlcj: Cannot create output directory: /home/dev/project/target/generated-sources/sqlcj/dev/example/generated
299-
sqlcj: Cannot write generated file: /home/dev/project/target/generated-sources/sqlcj/dev/example/generated/UsersRepository.java
300-
sqlcj: Cannot read output manifest: /home/dev/project/target/generated-sources/sqlcj/sqlcj-manifest.txt
301-
sqlcj: Cannot delete stale generated file: /home/dev/project/target/generated-sources/sqlcj/dev/example/generated/OrdersRepository.java
302-
sqlcj: Cannot write output manifest: /home/dev/project/target/generated-sources/sqlcj/sqlcj-manifest.txt
301+
sqlcj: Cannot read queries source: /home/dev/project/sql/missing.sql: No such file or directory
302+
sqlcj: Cannot create output directory: /home/dev/project/target/generated-sources/sqlcj/dev/example/generated: Not a directory
303+
sqlcj: Cannot write generated file: /home/dev/project/target/generated-sources/sqlcj/dev/example/generated/UsersRepository.java: Permission denied
304+
sqlcj: Cannot read output manifest: /home/dev/project/target/generated-sources/sqlcj/sqlcj-manifest.txt: Permission denied
305+
sqlcj: Cannot delete stale generated file: /home/dev/project/target/generated-sources/sqlcj/dev/example/generated/OrdersRepository.java: Permission denied
306+
sqlcj: Cannot write output manifest: /home/dev/project/target/generated-sources/sqlcj/sqlcj-manifest.txt: Permission denied
303307
```
304308

305309
## Generated Output and Failures

‎docs/postgresql.md‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,20 +219,22 @@ accepted:
219219

220220
### Failure Behavior
221221

222-
An unsupported type or an unsupported statement stops compilation. `sqlcj
223-
generate` prints a single message on standard error and exits with a non-zero
224-
status. Because every configured source is analyzed and generated before the
225-
run writes its first file, such a failure writes no generated file, and output
222+
An unsupported type, an unsupported statement, or a schema sqlcj cannot parse
223+
stops compilation. `sqlcj generate` prints a single message on standard error
224+
and exits with status `1`. Because every configured source is analyzed and
225+
generated before the run writes its first file, such a failure writes no
226+
generated file, and output
226227
written by an earlier successful run is left unchanged. The writing step itself
227228
is sequential rather than atomic; see
228229
[Generated Output and Failures](configuration.md#generated-output-and-failures).
229230

230-
The message names the schema source and the offending type or statement:
231+
The message names the schema source and the offending type or statement, or the
232+
syntax error with the line and column it was found at:
231233

232234
```text
233235
sqlcj: Invalid schema source /home/dev/project/schema.sql: Unsupported SQL column type: TIMESTAMPTZ
234236
sqlcj: Invalid schema source /home/dev/project/schema.sql: Unsupported schema statement: Alter
235-
sqlcj: Invalid schema source /home/dev/project/schema.sql: Failed to parse schema
237+
sqlcj: Invalid schema source /home/dev/project/schema.sql: Encountered unexpected token: ";" <ST_SEMICOLON> at line 4, column 1
236238
```
237239

238240
## Verified by

0 commit comments

Comments
 (0)