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

[BUG] [CCI] SerializationError class parameter data should be optional #418

Closed
timursaurus opened this issue Mar 8, 2023 · 3 comments · Fixed by #419
Closed

[BUG] [CCI] SerializationError class parameter data should be optional #418

timursaurus opened this issue Mar 8, 2023 · 3 comments · Fixed by #419
Labels
🐛 bug Something isn't working

Comments

@timursaurus
Copy link
Collaborator

timursaurus commented Mar 8, 2023

What is the bug?

In lib/Serializer.js, the ndserialize static method of the Serializer class throws a SerializationError with a single message argument when the input data type is not an Array, although the SerializationError class requires two arguments.

What is the expected behavior?

When the Array check fails, two required arguments should be passed to the SerializationError class

@timursaurus
Copy link
Collaborator Author

@nhtruong
Or passing the array to SerializationError would be better?

if (Array.isArray(array) === false) {
      throw new SerializationError('The argument provided is not an array', array);
}
- throw new SerializationError('The argument provided is not an array');
+ throw new SerializationError('The argument provided is not an array', array);

@nhtruong
Copy link
Collaborator

nhtruong commented Mar 8, 2023

Passing the data to the error constructor will give more context to the error so it's preferable. But I don't see the data being used in the Error class other than this.data = data

@nhtruong nhtruong removed the untriaged label Mar 8, 2023
@timursaurus
Copy link
Collaborator Author

Passing the data to the error constructor will give more context to the error so it's preferable. But I don't see the data being used in the Error class other than this.data = data

Right, changing the PR right now

@wbeckler wbeckler added the 🐛 bug Something isn't working label Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants