Skip to content

Refactor error report deserialisation #419

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

Merged

Conversation

fractalwrench
Copy link
Contributor

Goal

The ErrorReader class is hard to read in places which may have contributed to #418. This changeset attempts to improve readability by extracting methods so that each has a single responsibility.

Changeset

Breadcrumbs, stackframes, and threads are all serialised as a JSON array in the error report. The current implementation completes something like the following steps in a single method:

// 1. old scheme
void readBreadcrumbs() {
    // create an array
    // iterate around array objects
    // deserialise a breadcrumb
    // end an array
}

The step of deserialising individual JSON objects has now been extracted to a separate method, like thus:

// 2. new scheme
void readBreadcrumbs() {
    // create an array
    // iterate around array objects
    breadcrumbs.add(readBreadcrumb())
    // end an array
}

Breadcrumb readBreadcrumb() {
    // deserialise a breadcrumb
}

This ensures each method only has a single responsibility and improves readability of the code.

Tests

Ran existing tests, and performed testing as detailed in #418.

Copy link
Contributor

@bengourley bengourley left a comment

Choose a reason for hiding this comment

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

Looks good. What's up with the PR CI failure, flakey CI?

@fractalwrench
Copy link
Contributor Author

Yep, down to flaky CI - I've restarted the job.

@fractalwrench fractalwrench merged commit 026d226 into fix-error-deserialisation Jan 21, 2019
@fractalwrench fractalwrench deleted the error-deserialisation-refactor branch January 22, 2019 13:30
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.

None yet

2 participants