FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat(Cache): better error handling by NathanWalker · Pull Request #6458 · NativeScript/NativeScript · GitHub

feat(Cache): better error handling - #6458

Merged
vchimev merged 7 commits into
NativeScript:masterfrom
NathanWalker:feature/image-cache-error-handling
Dec 17, 2018
Merged

vchimev merged 7 commits into
NativeScript:masterfrom
NathanWalker:feature/image-cache-error-handling

Conversation

Copy link
Copy Markdown
Contributor

PR Checklist

What is the current behavior?

Usage of the image Cache class can result in many app problems due to invalid error handling conditions.

What is the new behavior?

Proper error handling can be wired up to circumvent troubling app conditions, ie:

this._cache.push((<DownloadRequest> {
  key: url,
  url: url,
  completed: (image: any, key: string) => {                                                       
    if (url === key) {
       // handle success
    }
  },
  error: (key: string) => {
    if (url === key) {
      // we can now properly handle error for failed url request here
    }
  }
}));

These changes are dependent on widgets PR here: NativeScript/tns-core-modules-widgets#147

ghost added the ♥ community PR label Oct 25, 2018

NathanWalker commented Oct 25, 2018
edited
Loading

Copy link
Copy Markdown
Contributor Author

This helps avoid these app crashes as well:

System.err: StackTrace:
System.err: Frame: function:'push.../node_modules/tns-core-modules/ui/image-cache/image-cache.js.Cache.set', file:'file:///data/data/org.nativescript.app/files/app/vendor.js', line: 134088, column: 21

vakrilov commented Nov 2, 2018

Copy link
Copy Markdown
Contributor

Hi and thanks for the PR!

The team have been quite busy baking the upcoming NativeScript 5.0 release. We hope you love it as much as we do! The major release is the reason we taking longer with PR reviews. We will resume active reviewing in the following weeks.

Thanks for your patience and for being awesome contributor!

vakrilov assigned ADjenkov and vchimev and unassigned ADjenkov Nov 20, 2018

vchimev commented Nov 26, 2018

Copy link
Copy Markdown
Contributor

Hey @NathanWalker,

Let's get merged the related pull request in tns-core-modules-widgets to facilitate the work here.

Could you also share how to reproduce the errors you experience?

Thank you!

vchimev left a comment
edited
Loading

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Hey @NathanWalker,

A few things:

  • the build of the tns-core-moduels package fails with:
tns-core-modules/ui/image-cache/image-cache.android.ts(56,13): error TS2345: Argument of type '{ onComplete: (result: any, context: any) => void; onError: (context: any) => void; }' is not assignable to parameter of type 'ICompleteCallback'.
  Object literal may only specify known properties, and 'onError' does not exist in type 'ICompleteCallback'.

The tns-platform-declarations/android/org.nativescript.widgets.d.ts needs to be updated with the changes in NativeScript/tns-core-modules-widgets#147 and NativeScript/tns-core-modules-widgets#149:

onError(err: string, context: Object): void;
tns-core-modules/http/http-request/http-request.android.ts(51,76): error TS2345: Argument of type '{ onComplete: (result: any, context: any) => void; }' is not assignable to parameter of type 'ICompleteCallback'.
  Property 'onError' is missing in type '{ onComplete: (result: any, context: any) => void; }'.

ghost added in progress and removed ♥ community PR labels Nov 30, 2018

vchimev commented Nov 30, 2018
edited
Loading

Copy link
Copy Markdown
Contributor

Hey @NathanWalker,

I committed a few updates on the API and implementation that we think are required and would expect in future pull requests.

Could you please handle my comments above to proceed forward?

Thank you!

vchimev force-pushed the feature/image-cache-error-handling branch from 376b6b1 to a05a1fb Compare November 30, 2018 16:04

vchimev commented Dec 11, 2018

Copy link
Copy Markdown
Contributor

Hey @NathanWalker, is there any update here?

NathanWalker and others added 4 commits December 11, 2018 10:17
Use arrow functions.
Remove an unnecessary `trace.write().
Update Android `constructor()`.
Move `key` and `image` check to `set()`.
Update `trace.write`.
NathanWalker force-pushed the feature/image-cache-error-handling branch from a05a1fb to 5701d21 Compare December 11, 2018 18:17

Copy link
Copy Markdown
Contributor Author

@vchimev ok got this updated now. The changes are based on this PR which I completely agree with:
NativeScript/tns-core-modules-widgets#149

Let me know if you need anything else here.

vchimev commented Dec 12, 2018

Copy link
Copy Markdown
Contributor

test

ghost assigned SvetoslavTsenov Dec 14, 2018

Copy link
Copy Markdown
Contributor

test

vchimev closed this Dec 16, 2018
ghost removed the in progress label Dec 16, 2018
vchimev reopened this Dec 17, 2018
ghost added the in progress label Dec 17, 2018
vchimev merged commit 3481e6f into NativeScript:master Dec 17, 2018
ghost removed the in progress label Dec 17, 2018

lock Bot commented Dec 17, 2019

Copy link
Copy Markdown

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock Bot locked and limited conversation to collaborators Dec 17, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants


Back | FazBrowse Home | New Git URL