How to use the @nakedobjects/services.ErrorCategory.HttpClientError function in @nakedobjects/services

To help you get started, we’ve selected a few @nakedobjects/services examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NakedObjectsGroup / NakedObjectsFramework / Spa2 / nakedobjectsspa / view-models / src / error-view-model.ts View on Github external
constructor(error: ErrorWrapper | null) {
        this.originalError = error;
        if (error) {
            this.title = error.title;
            this.description = error.description;
            this.errorCode = error.errorCode;
            this.message = error.message;
            const stackTrace = error.stackTrace;

            this.stackTrace = stackTrace && stackTrace.length !== 0 ? stackTrace : null;

            this.isConcurrencyError =
                error.category === ErrorCategory.HttpClientError &&
                error.httpErrorCode === HttpStatusCode.PreconditionFailed;
        }

        this.description = this.description || 'No description available';
        this.errorCode = this.errorCode || 'No code available';
        this.message = this.message || 'No message available';
        this.stackTrace = this.stackTrace || ['No stack trace available'];
    }