Skip to content

Commit 71f3f48

Browse files
committed
fix(libnpmpublish): use EUSAGE for provenance and provenanceFile conflict
Per review on #9882, reuse the existing EUSAGE convention instead of introducing a dedicated EPROVENANCECONFLICT error code, and align the message and README wording accordingly. Signed-off-by: Yunseo Kim <[email protected]>
1 parent df4e300 commit 71f3f48

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎workspaces/libnpmpublish/README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ A couple of options of note:
5959
* `opts.provenance` - when running in a supported CI environment, will trigger
6060
the generation of a signed provenance statement to be published alongside
6161
the package. Mutually exclusive with the `provenanceFile` option; providing
62-
both will throw an `EPROVENANCECONFLICT` error. In the npm CLI's trusted
62+
both will throw an `EUSAGE` error. In the npm CLI's trusted
6363
publishing flows, automatic provenance generation is skipped when
6464
`provenanceFile` is supplied.
6565

6666
* `opts.provenanceFile` - specifies the path to an externally-generated
6767
provenance statement to be published alongside the package. Mutually
6868
exclusive with the `provenance` option; providing both will throw an
69-
`EPROVENANCECONFLICT` error. The specified file should be a
69+
`EUSAGE` error. The specified file should be a
7070
[Sigstore Bundle](https://github.com/sigstore/protobuf-specs/blob/main/protos/sigstore_bundle.proto)
7171
containing a [DSSE](https://github.com/secure-systems-lab/dsse)-packaged
7272
provenance statement.

‎workspaces/libnpmpublish/lib/publish.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ const buildMetadata = async (registry, manifest, tarballData, spec, opts) => {
146146
let transparencyLogUrl
147147
if (provenance === true && provenanceFile) {
148148
throw Object.assign(
149-
new Error('provenance and provenanceFile are mutually exclusive'),
150-
{ code: 'EPROVENANCECONFLICT' }
149+
new Error('provenance and provenanceFile cannot be used together'),
150+
{ code: 'EUSAGE' }
151151
)
152152
}
153153
if (provenance === true || provenanceFile) {

‎workspaces/libnpmpublish/test/publish.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -898,8 +898,8 @@ t.test('provenance and provenanceFile together throws', async t => {
898898
provenanceFile: './test/fixtures/valid-bundle.json',
899899
}),
900900
{
901-
code: 'EPROVENANCECONFLICT',
902-
message: /mutually exclusive/,
901+
code: 'EUSAGE',
902+
message: /cannot be used together/,
903903
}
904904
)
905905
})

0 commit comments

Comments
 (0)