Skip to content

Commit

Permalink
CLI Deploy: Print helpful error messages for invalid spec (#863)
Browse files Browse the repository at this point in the history
* print helpful error messages when an invalid spec is encountered

* add changeset file

* remove strict:false option

* seems like doc.toJSON does not throw when there are errors

* bump versions

---------

Co-authored-by: Joe Clark <[email protected]>
  • Loading branch information
midigofrank and josephjclark authored Feb 7, 2025
1 parent 8b015bc commit 9202fb2
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 2 deletions.
11 changes: 11 additions & 0 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# @openfn/cli

## 1.11.0

### Minor Changes

- 706124a: deploy: Print helpful error messages when an invalid spec is encountered

### Patch Changes

- Updated dependencies [706124a]
- @openfn/deploy@0.11.0

## 1.10.4

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openfn/cli",
"version": "1.10.4",
"version": "1.11.0",
"description": "CLI devtools for the openfn toolchain.",
"engines": {
"node": ">=18",
Expand Down
6 changes: 6 additions & 0 deletions packages/deploy/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @openfn/deploy

## 0.11.0

### Minor Changes

- 706124a: Print helpful error messages when an invalid spec is encountered

## 0.10.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/deploy/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openfn/deploy",
"version": "0.10.0",
"version": "0.11.0",
"description": "Deploy projects to Lightning instances",
"type": "module",
"exports": {
Expand Down
5 changes: 5 additions & 0 deletions packages/deploy/src/pull.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Logger } from '@openfn/logger';
import { writeFile } from 'fs/promises';
import path from 'path';
import { getState, getSpec } from './index';
import { DeployError } from './deployError';

async function getAllSpecJobs(
config: DeployConfig,
Expand Down Expand Up @@ -103,6 +104,10 @@ async function extractJobsToDisk(
},
});

if (doc.errors.length > 0) {
throw new DeployError(doc.errors[0].message, 'SPEC_ERROR');
}

return doc.toString();
}

Expand Down

0 comments on commit 9202fb2

Please sign in to comment.