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

Add test for issue #789 showing error message [Object object] #792

Merged
merged 3 commits into from
Jan 4, 2018

Conversation

bassettsj
Copy link

Please do not create a Pull Request without creating an issue first.
Any change needs to be discussed before proceeding.
Failure to do so may result in the rejection of the pull request.

Please provide enough information so that others can review your pull request:

Explain the details for making this change. What existing problem does the pull request solve?

Demonstrating the bad error message I was seeing after setting up demo registry on heroku. This is showing the problematic error message I saw.

Test plan (required)

Running unit tests should prove if the error is fixed or not.

Closing issues

#789 would be closed if I fixed the failing test as well, but I would like to discuss if it is an actual bad error condition or not.

@matteofigus
Copy link
Member

I think this sounds legit. When we have an error from there, we should show something meaningful in the api response.

…bject]

- add new test case reproducing the error
@@ -0,0 +1,11 @@
module.exports = function errorToString(err) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@matteofigus I wasn't sure where to put this but but it would just see if it has a message attribute that is a string and returns that.

)}${conf.local
? settings.registry.localStaticRedirectorPath
: ''}${filePath}`,
`${repository.getComponentPath(componentName, componentVersion)}${
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't change this, but it seems prettier seems to want to change it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, that is by design. Perhaps we should mention that in the contributing guidelines to avoid confusion :)

@matteofigus
Copy link
Member

Closes #789

Copy link
Member

@matteofigus matteofigus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of super minor changes. Good job!

@@ -0,0 +1,11 @@
module.exports = function errorToString(err) {
const isString = typeof error === 'string';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use lodash's _.isString? This is for consistency with other bits in the codebase

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed

return err.msg;
}

return err + '';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about err.toString() which perhaps is a bit more readable

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... That might cause errors like TypeError: Cannot read property 'toString' of undefined if it is null or undefined.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point!

@matteofigus matteofigus merged commit df8f0e1 into opencomponents:master Jan 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants