Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide detailed error when file not found #36

Closed
derberg opened this issue Jul 26, 2021 · 3 comments · Fixed by #42
Closed

Hide detailed error when file not found #36

derberg opened this issue Jul 26, 2021 · 3 comments · Fixed by #42
Labels
bug Something isn't working released

Comments

@derberg
Copy link
Member

derberg commented Jul 26, 2021

There are 2 bugs related to some recent functionality:

  1. When you want to add to the context a file that does not exist I get errors like
 ERROR  specification file not found in that path.

 dist/hooks/context/contextService.js:55:19

 52:     }
 53:     addContext(context, key, specFile) {
 54:         if (specFile.isNotValid()) {
 55:             throw new models_1.SpecFileNotFoundError();
 56:         }
 57:         context.store[String(key)] = specFile.getSpecificationName();
 58:         return context;

 - ContextService.addContext (dist/hooks/context/contextService.js:55:19)
 - Object.addContext (dist/hooks/context/hooks.js:45:55)
 - AddContext (dist/components/Context/Context.js:45:60)
 - renderWithHooks (node_modules/react-reconciler/cjs/react-reconciler.development.js:6036:18)
 - mountIndeterminateComponent (node_modules/react-reconciler/cjs/react-reconciler.development.js:8570:13)
 - beginWork$1 (node_modules/react-reconciler/cjs/react-reconciler.development.js:9938:16)
 - Object.invokeGuardedCallbackImpl (node_modules/react-reconciler/cjs/react-reconciler.development.js:11563:10)
 - invokeGuardedCallback (node_modules/react-reconciler/cjs/react-reconciler.development.js:11740:31)
 - beginWork$$1 (node_modules/react-reconciler/cjs/react-reconciler.development.js:15778:7)
 - performUnitOfWork (node_modules/react-reconciler/cjs/react-reconciler.development.js:14696:12)

and instead, I should just see errors like AsyncAPI file not found under ${PATH} path

@derberg derberg added the bug Something isn't working label Jul 26, 2021
@Souvikns
Copy link
Member

@derberg I was trying to reproduce this,
I ran command

asyncapi context add check ./asyncapi.yml

and the file path is invalid but I don't get a detailed error.

image

@derberg
Copy link
Member Author

derberg commented Jul 29, 2021

strange, maybe I see it as I use it as a global package, I install the CLI with npm i ./ -g so I can use asyncapi and not dist directly.

anyway I think it is because in this case of file not found and also when the spec file is not valid - the throw new error is invoked, this is why I can get stack error. Shouldn't it rather always return an error component like with other context related errors? return <ContextError error={error} />;

@asyncapi-bot
Copy link
Contributor

🎉 This issue has been resolved in version 0.3.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants