Skip to content
This repository has been archived by the owner on Sep 11, 2020. It is now read-only.

Lyh data store #4

Open
wants to merge 8 commits into
base: dev
Choose a base branch
from
Open

Lyh data store #4

wants to merge 8 commits into from

Conversation

nooblyh
Copy link

@nooblyh nooblyh commented Feb 13, 2019

No description provided.

Copy link
Contributor

@YanB25 YanB25 left a comment

Choose a reason for hiding this comment

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

Combining multiple statements is error-prone and difficult to refactor.
Say function f1, f2 and f3
Good Practice

foo := f1()
bar := f2()
zoo := f3(foo, bar)

Bad Practice

zoo := f3(
    f1(), f2())

}
SimpleStream.RecordList = append(SimpleStream.RecordList, record)
}
if errcount != 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

contract: return (nil, error) in failure.

Copy link
Contributor

Choose a reason for hiding this comment

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

BTW, you "hide" the error message in your codes.
Just stop your codes and "throw" the error when the very FIRST error occurs.

Copy link
Author

Choose a reason for hiding this comment

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

BTW, you "hide" the error message in your codes.
Just stop your codes and "throw" the error when the very FIRST error occurs.

My thought was to track and skip the records which can't be deserialized, and return other good records...

Copy link
Contributor

@YanB25 YanB25 Feb 15, 2019

Choose a reason for hiding this comment

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

BTW, you "hide" the error message in your codes.
Just stop your codes and "throw" the error when the very FIRST error occurs.

My thought was to track and skip the records which can't be deserialized, and return other good records...

When an error occurs,

  • If you believe you can handle it, do so.
  • If you are unable(or not responsible) to handle it, return the error. Let other ones to handle it.

Generally, Deserialize should be perfectly successful. If it failed, you do not know how to handle it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants