Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-21664

The JS REST client: switch to "error guards" approach to minimize code nesting

    XMLWordPrintable

Details

    Description

      • Instead of nesting if/else branches early breaks should be used:
        function(error, success) {
            if (error) {
                callback(new CAPIError({
                     errorText : "An error occured during ensureAuthentication call!"
                }));
            return;
            }
            ...
        }
        
      • In addition it's also would be useful to remove the empty Response objects (created in case of errors).

      Attachments

        Activity

          People

            Unassigned Unassigned
            Anton.Petrushenkov-obsolete@ez.no Anton Petrushenkov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 hours, 30 minutes
                3h 30m