File

C:/GoDev/src/TCSTK-Angular/projects/tibco-tcstk/tc-core-lib/src/lib/components/tibco-cloud-error/tibco-cloud-error.component.ts

Description

Global Error Handling, contains generic Error Handling for

  • NO_ROLE :: You are not a Member of this Application, please contact the Application- or Subscription-Owner
  • NO_ACCESS :: You are not entitled to access this Application, please contact the Application- or Subscription-Owner
  • NO_ROUTE_ACCESS :: Sorry but you do not have the required role to access this page of the application, please contact the application owner
  • NOT_ADMIN_INIT :: Before using this application a member of the TIBCO Live Apps Admin Group must login to set initial configuration

Implements

OnInit

Metadata

selector tc-tibco-cloud-error
styleUrls ./tibco-cloud-error.component.css
templateUrl ./tibco-cloud-error.component.html

Index

Properties

Constructor

constructor(route: ActivatedRoute)

todo: Add logger

Parameters :
Name Type Optional
route ActivatedRoute No

Properties

code
Type : string
data
Type : string
knownErrorList
Type : []
Default value : [ { 'errorCode' : 'NO_ROLE', 'errorTitle' : 'Access Denied', 'errorMessage' : 'You are not a Member of this Application, please contact the Application- or Subscription-Owner.' }, { 'errorCode' : 'NO_ACCESS', 'errorTitle' : 'Access Denied', 'errorMessage' : 'You are not entitled to access this Application, please contact the Application- or Subscription-Owner.' }, { 'errorCode' : 'NO_ROUTE_ACCESS', 'errorTitle' : 'Access Denied', 'errorMessage' : 'Sorry but you do not have the required role to access this page of the application, please contact the application owner' }, { 'errorCode' : 'NOT_ADMIN_INIT', 'errorTitle' : 'Admin configuration required', 'errorMessage' : 'Before using this application a member of the TIBCO Live Apps Admin Group must login to set initial configuration' } ]
message
Type : string
title
Type : string
import { Component, OnInit } from '@angular/core';
import {ActivatedRoute} from '@angular/router';

/**
 * Global Error Handling, contains generic Error Handling for
 *
 * - NO_ROLE :: You are not a Member of this Application, please contact the Application- or Subscription-Owner
 * - NO_ACCESS :: You are not entitled to access this Application, please contact the Application- or Subscription-Owner
 * - NO_ROUTE_ACCESS :: Sorry but you do not have the required role to access this page of the application, please contact the application owner
 * - NOT_ADMIN_INIT :: Before using this application a member of the TIBCO Live Apps Admin Group must login to set initial configuration
 */

/**
 * Exception Handling page
 *
 *@example <tc-tibco-cloud-error></tc-tibco-cloud-error>
 */
@Component({
  selector: 'tc-tibco-cloud-error',
  templateUrl: './tibco-cloud-error.component.html',
  styleUrls: ['./tibco-cloud-error.component.css']
})
export class TibcoCloudErrorComponent implements OnInit {

  /**
   * todo: Add logger
   */
  constructor(protected route: ActivatedRoute) {
    this.message = '';
    this.route.params.subscribe(params => {
      console.log(params); // log the entire params object
      console.log(params['errorCode']);
      console.log(params['errorData?']);
      if (params['errorCode'] != null) {
        this.code = params['errorCode'];
        this.title = this.knownErrorList.find(x => x.errorCode === this.code).errorTitle;
        this.message = this.knownErrorList.find(x => x.errorCode === this.code).errorMessage;
        this.data = params['errorData'];
      } else {
        this.code = 'Unknown Error Code';
      }
    });
  }

  code: string;
  title: string;
  message: string;
  data: string;

  knownErrorList = [
    {
      'errorCode' : 'NO_ROLE',
      'errorTitle' : 'Access Denied',
      'errorMessage' : 'You are not a Member of this Application, please contact the Application- or Subscription-Owner.'

    },
    {
      'errorCode' : 'NO_ACCESS',
      'errorTitle' : 'Access Denied',
      'errorMessage' : 'You are not entitled to access this Application, please contact the Application- or Subscription-Owner.'

    },
    {
      'errorCode' : 'NO_ROUTE_ACCESS',
      'errorTitle' : 'Access Denied',
      'errorMessage' : 'Sorry but you do not have the required role to access this page of the application, please contact the application owner'
    },
    {
      'errorCode' : 'NOT_ADMIN_INIT',
      'errorTitle' : 'Admin configuration required',
      'errorMessage' : 'Before using this application a member of the TIBCO Live Apps Admin Group must login to set initial configuration'
    }
  ];

  /**
   * @ignore
   */
  ngOnInit() {
  }


}


<div fxFill fxLayout="row" fxLayoutAlign="center center">
  <div fxFlex fxLayout="column" fxLayoutAlign="start center">
    <mat-icon class="tcs-error-icon" [svgIcon]="'ic-error-handler'"></mat-icon>
    <div style="margin-left: 30px; margin-right: 30px;" fxLayout="column" fxLayoutGap="10px">
      <span class="tcs-error-title">{{title}}</span>
      <span class="tcs-error-message">{{message}}</span>
      <span class="tcs-error-code">[{{code}}] - {{data}}</span>
    </div>
  </div>
</div>

./tibco-cloud-error.component.css

.tcs-error-icon {
  height: 300px;
  width: 300px;
}

.tcs-error-icon svg {
  width: 300px;
  height: 300px;
}

.tcs-error-title {
  font-family: "Source Sans Pro";
  font-size: 40px;
}

.tcs-error-message {
  font-family: "Source Sans Pro";
  font-size: 16px;
  font-color: #212121;
}

.tcs-error-code {
  font-family: "Source Sans Pro";
  font-size: 16px;
  font-color: grey;
}
Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""