Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upfeature(config): improved error message for invalid angular-cli.json #2565
Conversation
|
#2536 is about npm issues so I don't think it'd help. It's a fine idea though, to improve these messages. |
| @@ -80,10 +80,16 @@ export class CliConfig<JsonType> { | |||
|
|
|||
| try { | |||
| content = JSON.parse(configContent); | |||
| } catch (err) { | |||
| throw 'Parsing angular-cli.json failed. Please make sure your angular-cli.json is valid' | |||
This comment has been minimized.
This comment has been minimized.
filipesilva
Oct 10, 2016
Member
Can you throw a new InvalidConfigError with the message both here and below?
This comment has been minimized.
This comment has been minimized.
RoopeHakulinen
Oct 10, 2016
Author
Contributor
Using the class currently declared as InvalidConfigError always just prints "Error", no matter what you pass to it. For that reason I fixed it to use the way provided in this SO answer. Now it prints the error correctly. Also applied the same for another existing use of the InvalidConfigError class.
This comment has been minimized.
This comment has been minimized.
filipesilva
Oct 10, 2016
Member
Awesome, that works for me. There's some CI errors now though, they seem related to compilation:
packages/angular-cli/models/config/config.ts(10,15): error TS7006: Parameter 'message' implicitly has an 'any' type.
Just a matter of adding constructor(message: string) { I believe.
This comment has been minimized.
This comment has been minimized.
RoopeHakulinen
Oct 10, 2016
Author
Contributor
Right, how silly of me.. Fixed, let's see if it passes this time :)
|
Oh I see, you wanted to say #2526! I'll edit your comment. |
|
Yeah, #2526 is the correct one. Sorry for inconvenience. |
Earlier invalid angular-cli.json yielded only "Error". Now it prints something like: Parsing angular-cli.json failed. Please make sure your angular-cli.json is valid JSON. Error: SyntaxError: Unexpected token s in JSON at position 2 Almost the same message is now also used for the other configuration files (schema and other).
|
Seems so. I'll merge soon. |
…ngular#2565) Earlier invalid angular-cli.json yielded only "Error". Now it prints something like: Parsing angular-cli.json failed. Please make sure your angular-cli.json is valid JSON. Error: SyntaxError: Unexpected token s in JSON at position 2 Almost the same message is now also used for the other configuration files (schema and other).
…2565) Earlier invalid angular-cli.json yielded only "Error". Now it prints something like: Parsing angular-cli.json failed. Please make sure your angular-cli.json is valid JSON. Error: SyntaxError: Unexpected token s in JSON at position 2 Almost the same message is now also used for the other configuration files (schema and other).
…ngular#2565) Earlier invalid angular-cli.json yielded only "Error". Now it prints something like: Parsing angular-cli.json failed. Please make sure your angular-cli.json is valid JSON. Error: SyntaxError: Unexpected token s in JSON at position 2 Almost the same message is now also used for the other configuration files (schema and other).
angular-automatic-lock-bot
bot
commented
Sep 10, 2019
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
RoopeHakulinen commentedOct 7, 2016
•
edited by filipesilva
Earlier invalid angular-cli.json yielded only "Error". Now it prints something like:
Parsing angular-cli.json failed. Please make sure your angular-cli.json is valid JSON. Error:
SyntaxError: Unexpected token s in JSON at position 2
Almost the same message is now also used for the other configuration files (schema and other).
This fixes #2526