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

The JS REST client's CAPIError Class major refactoring

    XMLWordPrintable

Details

    Description

      • The Error should have defined fields instead of utilizing a object literal wrapping approach.
      • An Error should always recieve a message as first argument. Arbitrary fields may be added after this.
      • Having a defined Error structure allows for more generic error handling
      • If different error types are needed those should be created as different error classes
      • All custom errors should inherit from the default Error prototype. In order to allow proper handling as well as proper StackTraces:
        var CAPIError = function (message, something, else) {
        this.name = "CAPIError";
        this.message = message;
        } CAPIError.prototype =
        new Error();
        CAPIError.prototype.constructor = CAPIError
        

      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 - 1 day, 2 hours
                1d 2h