cyclosproject / ng-swagger-gen

A Swagger 2.0 codegen for Angular
MIT License
220 stars 100 forks source link

Bug: Running ng-swagger-gen does never return an error code !=0 even if errors occur #239

Closed BenniG82 closed 4 years ago

BenniG82 commented 4 years ago

Hi, thanks for this awesome code generator. I really like using it and I like the layout of the generated code.

But I have one issue which sometimes makes debugging hard. Your generator never returns an error to the commandline. So chaining calls breaks at the wrong position. Example:

 npx ng-swagger-gen -i file-does-not-exist.json -o ./generated-code  && echo "success" || echo "error"

This produces the following output

Error reading swagger location file-does-not-exist.json: Error: Error opening file "/home/bgniza/angular-monorepo/file-does-not-exist.json" 
ENOENT: no such file or directory, open '/home/bgniza/angular-monorepo/file-does-not-exist.json'
success

As you can see success is the last message, but I would expect error

I hope this is easy so fix. I'll take a look into the code right after filing this issue :)

Thanks and best regards Benjamin

BenniG82 commented 4 years ago

Okay, that was easy to fix:

240