Skip to content

Commit b66dffb

Browse files
authored
Projectpath error message (#274)
* Improve error message * Improve error message
1 parent 2fc01a1 commit b66dffb

File tree

4 files changed

+18
-10
lines changed

4 files changed

+18
-10
lines changed

dist/index.js

Lines changed: 14 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/model/unity-versioning.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ describe('Unity Versioning', () => {
1414
});
1515

1616
describe('read', () => {
17-
it('does not throw', () => {
18-
expect(() => UnityVersioning.read('')).not.toThrow();
17+
it('throws for invalid path', () => {
18+
expect(() => UnityVersioning.read('')).toThrow(Error);
1919
});
2020

2121
it('reads from test-project', () => {

src/model/unity-versioning.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import * as core from '@actions/core';
21
import * as fs from 'fs';
32
import path from 'path';
43

@@ -17,8 +16,7 @@ export default class UnityVersioning {
1716
static read(projectPath) {
1817
const filePath = path.join(projectPath, 'ProjectSettings', 'ProjectVersion.txt');
1918
if (!fs.existsSync(filePath)) {
20-
core.warning(`Could not find "${filePath}", keeping unityVersion as "auto"`);
21-
return 'auto';
19+
throw new Error(`Project settings file not found at "${filePath}". Have you correctly set the projectPath?`);
2220
}
2321
return UnityVersioning.parse(fs.readFileSync(filePath, 'utf8'));
2422
}

0 commit comments

Comments
 (0)