Skip to content

Commit bf677a9

Browse files
Julusianrjmunro
andauthored
fix: improve error messaging when uploading blueprints (#1568)
Co-authored-by: Robert (Jamie) Munro <[email protected]>
1 parent a05d14f commit bf677a9

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

meteor/server/api/blueprints/__tests__/api.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,8 @@ describe('Test blueprint management api', () => {
217217
)
218218
})
219219
test('empty body', async () => {
220-
await expect(uploadBlueprint(DEFAULT_CONNECTION, protectString('blueprint99'), '')).rejects.toThrowMeteor(
221-
400,
222-
'Blueprint blueprint99 failed to parse'
220+
await expect(uploadBlueprint(DEFAULT_CONNECTION, protectString('blueprint99'), '')).rejects.toMatchToString(
221+
/Error evaluating Blueprint "blueprint99"(.+)/
223222
)
224223
})
225224
test('body not a manifest', async () => {

meteor/server/api/blueprints/api.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import { DBStudio } from '@sofie-automation/corelib/dist/dataModel/Studio'
3232
import { UserPermissions } from '@sofie-automation/meteor-lib/dist/userPermissions'
3333
import { assertConnectionHasOneOfPermissions, RequestCredentials } from '../../security/auth'
3434
import { blueprintsPerformDevelopmentMode } from './development'
35+
import { stringifyError } from '@sofie-automation/shared-lib/dist/lib/stringifyError'
3536

3637
const PERMISSIONS_FOR_MANAGE_BLUEPRINTS: Array<keyof UserPermissions> = ['configure']
3738

@@ -170,8 +171,10 @@ async function innerUploadBlueprint(
170171
let blueprintManifest: SomeBlueprintManifest | undefined
171172
try {
172173
blueprintManifest = evalBlueprint(newBlueprint)
173-
} catch (_e) {
174-
throw new Meteor.Error(400, `Blueprint ${blueprintId} failed to parse`)
174+
} catch (e) {
175+
logger.error(`Error evaluating Blueprint "${blueprintId}": "${stringifyError(e)}"`)
176+
177+
throw new Meteor.Error(400, `Error evaluating Blueprint "${blueprintId}": "${stringifyError(e)}"`)
175178
}
176179

177180
if (!_.isObject(blueprintManifest))

0 commit comments

Comments
 (0)