Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

590 B
Raw Blame
import { HttpErrorResponse } from '@angular/common/http';
import { ErrorResource } from 'core-app/features/hal/resources/error-resource';

export class HalError extends Error {
  readonly name = 'HALError';

  get message():string {
    return this.resource?.message || this.httpError?.message || 'Unknown error';
  }

  get errorIdentifier():string {
    return this.resource?.errorIdentifier || 'unknown';
  }

  constructor(
    readonly httpError:HttpErrorResponse,
    readonly resource:ErrorResource|null,
  ) {
    super();
    Object.setPrototypeOf(this, HalError.prototype);
  }
}