Skip to content

fix: Dio error holds a reference to null values #825

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
merged 2 commits into from
Feb 26, 2023

Conversation

Nidal-Bakir
Copy link
Member

@Nidal-Bakir Nidal-Bakir commented Feb 24, 2023

When an error occurs, the Dio error object could hold null properties causing the error (Type 'Null' is not a subtype of type 'Object')

New Pull Request Checklist

Issue Description

Closes: #774

Approach

Add null aware operator ??:

on dio.DioError catch (error) {
      return ParseNetworkResponse(
        data: error.response?.data ?? _fallbackErrorData,
        statusCode: error.response?.statusCode ?? ParseError.otherCause,
      );
    }

TODOs before merging

All set

  • Add tests
  • Add changes to documentation (guides, repository pages, in-code descriptions)
  • A changelog entry

When an error occurs, the Dio error object could hold null properties  causing the error (Type 'Null' is not a subtype of type 'Object')
@parse-github-assistant
Copy link

I will reformat the title to use the proper commit message syntax.

@parse-github-assistant parse-github-assistant bot changed the title fix: dio error holds a reference to null values fix: Dio error holds a reference to null values Feb 24, 2023
@parse-github-assistant
Copy link

Thanks for opening this pull request!

mbfakourii
mbfakourii previously approved these changes Feb 25, 2023
Copy link
Member

@mbfakourii mbfakourii left a comment

Choose a reason for hiding this comment

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

Thanks for checking nulls, looks good

Copy link
Member

@mtrezza mtrezza left a comment

Choose a reason for hiding this comment

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

Could you add a changelog entry using the PR title and bump the version? See existing entries for examples.

Lint also needs some changes.

@codecov
Copy link

codecov bot commented Feb 25, 2023

Codecov Report

Base: 15.88% // Head: 15.82% // Decreases project coverage by -0.07% ⚠️

Coverage data is based on head (69e3a1b) compared to base (b07ce8c).
Patch coverage: 0.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #825      +/-   ##
==========================================
- Coverage   15.88%   15.82%   -0.07%     
==========================================
  Files          47       47              
  Lines        2865     2876      +11     
==========================================
  Hits          455      455              
- Misses       2410     2421      +11     
Impacted Files Coverage Δ
...ackages/dart/lib/src/network/parse_dio_client.dart 0.00% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@mtrezza mtrezza 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! Waiting for CI to pass...

@mtrezza mtrezza merged commit 2542178 into parse-community:master Feb 26, 2023
@Nidal-Bakir Nidal-Bakir deleted the bug_fix#774 branch February 26, 2023 12:42
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.

Type 'Null' is not a subtype of type 'String'
3 participants