Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/lu/src/parser/lu/luMerger.js
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,7 @@ const parseLuFile = async function(luOb, log, luis_culture) {
try {
parsedContent = await parseFileContents.parseFile(luOb.content, log, luis_culture);
} catch (err) {
err.source = luOb.id;
throw(err);
}
if (!parsedContent) {
Expand Down
6 changes: 5 additions & 1 deletion packages/lu/src/parser/lubuild/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ export class Builder {
result = await LuisBuilderVerbose.build(luFiles, true, culture)
fileContent = result.parseToLuContent()
} catch (err) {
err.text = `Invalid LU file ${file}: ${err.text}`
if (err.source) {
err.text = `Invalid LU file ${err.source}: ${err.text}`
} else {
err.text = `Invalid LU file ${file}: ${err.text}`
}
throw(new exception(retCode.errorCode.INVALID_INPUT_FILE, err.text))
}

Expand Down
3 changes: 2 additions & 1 deletion packages/luis/test/commands/luis/build.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ describe('luis:build cli parameters test', () => {
test
.stdout()
.stderr()
.command(['luis:build', '--authoringKey', uuidv1(), '--in', `${path.join(__dirname, './../../fixtures/testcases/bad3.lu')}`, '--botName', 'Contoso'])
.command(['luis:build', '--authoringKey', uuidv1(), '--in', `${path.join(__dirname, './../../fixtures/testcases/invalid_import_file.lu')}`, '--botName', 'Contoso'])
.it('displays an error if error occurs in parsing lu content', ctx => {
expect(ctx.stderr).to.contain('Invalid LU file')
expect(ctx.stderr).to.contain('bad3.lu')
expect(ctx.stderr).to.contain('[ERROR] line 4:0 - line 4:16: Invalid intent body line, did you miss \'-\' at line begin')
})
})
Expand Down
5 changes: 5 additions & 0 deletions packages/luis/test/fixtures/testcases/invalid_import_file.lu
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# greeting
- hi
- hello

[import lu file with error](bad3.lu)