Skip to content

Commit

Permalink
Merge branch 'epic/ssr-error-handling' into epic/ssr-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeyber committed Oct 10, 2023
2 parents 37239d3 + 77e8d8d commit 810956d
Show file tree
Hide file tree
Showing 30 changed files with 62 additions and 33 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/ci-continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,33 @@ jobs:
- name: Run unit tests
run: |
ci-scripts/unit-tests.sh
build-libs:
# TODO: For Testing SSR Epic only, remove job before merge
name: CI - Build Libraries
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v2
with:
path: |
node_modules
projects/storefrontapp-e2e-cypress/node_modules
~/.cache/Cypress
key: nodemodules-${{ github.event.pull_request.base.sha }}
restore-keys: nodemodules-${{ github.event.pull_request.base.sha }}
- name: Package installation
run: npm ci
- name: Build Libraries
run: |
npm run build:libs
sonarqube_scan:
name: CI - SonarQube Scan
runs-on: ubuntu-latest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from '../../../model/consent.model';
import { StateUtils } from '../../../state/utils/index';
import { ANONYMOUS_CONSENTS } from '../anonymous-consents-state';
import { ErrorActionType } from '@spartacus/core';
import { ErrorActionType } from '../../../model/index';

export const LOAD_ANONYMOUS_CONSENT_TEMPLATES =
'[Anonymous Consents] Load Anonymous Consent Templates';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { StateUtils } from '../../../../state/utils/index';
import { ClientToken } from '../../models/client-token.model';
import { CLIENT_TOKEN_DATA } from '../client-auth-state';
import { ErrorActionType } from '@spartacus/core';
import { ErrorActionType } from '../../../../model/index';

export const LOAD_CLIENT_TOKEN = '[Token] Load Client Token';
export const LOAD_CLIENT_TOKEN_FAIL = '[Token] Load Client Token Fail';
Expand Down
2 changes: 1 addition & 1 deletion projects/core/src/cms/store/actions/components.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { CmsComponent } from '../../../model/cms.model';
import { PageContext } from '../../../routing/index';
import { StateUtils } from '../../../state/utils/index';
import { COMPONENT_ENTITY } from '../cms-state';
import { ErrorActionType } from '@spartacus/core';
import { ErrorActionType } from '../../../model/index';

export const LOAD_CMS_COMPONENT = '[Cms] Load Component';
export const LOAD_CMS_COMPONENT_FAIL = '[Cms] Load Component Fail';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import { StateUtils } from '../../../state/utils/index';
import { NAVIGATION_DETAIL_ENTITY } from '../cms-state';
import { ErrorActionType } from '@spartacus/core';
import { ErrorActionType } from '../../../model/index';

export const LOAD_CMS_NAVIGATION_ITEMS = '[Cms] Load NavigationEntry items';
export const LOAD_CMS_NAVIGATION_ITEMS_FAIL =
Expand Down
2 changes: 1 addition & 1 deletion projects/core/src/cms/store/actions/page.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { PageContext } from '../../../routing/index';
import { StateUtils } from '../../../state/utils/index';
import { Page } from '../../model/page.model';
import { ErrorActionType } from '@spartacus/core';
import { ErrorActionType } from '../../../model/index';

export const LOAD_CMS_PAGE_DATA = '[Cms] Load Page Data';
export const LOAD_CMS_PAGE_DATA_FAIL = '[Cms] Load Page Data Fail';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Injectable } from '@angular/core';
import { Actions, createEffect } from '@ngrx/effects';
import { filter, tap } from 'rxjs/operators';
import { EffectsErrorHandlerService } from './effects-error-handler.service';
import { ErrorAction } from '@spartacus/core';
import { ErrorAction } from '../../model/index';
import { Observable } from 'rxjs';

@Injectable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@

import { ErrorHandler, Injectable } from '@angular/core';
import { Action } from '@ngrx/store';
import { ErrorAction, ErrorActionType, HttpErrorModel } from '@spartacus/core';
import {
ErrorAction,
ErrorActionType,
HttpErrorModel,
} from '../../model/index';
import { HttpErrorResponse } from '@angular/common/http';

@Injectable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { Action } from '@ngrx/store';
import { ErrorModel } from '../../../model/misc.model';
import { ProductReference } from '../../../model/product.model';
import { ErrorAction } from '@spartacus/core';
import { ErrorAction } from '../../../model';

export const LOAD_PRODUCT_REFERENCES = '[Product] Load Product References Data';
export const LOAD_PRODUCT_REFERENCES_FAIL =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { Action } from '@ngrx/store';
import { ErrorModel } from '../../../model/misc.model';
import { Review } from '../../../model/product.model';
import { ErrorAction } from '@spartacus/core';
import { ErrorAction } from '../../../model/index';

export const LOAD_PRODUCT_REVIEWS = '[Product] Load Product Reviews Data';
export const LOAD_PRODUCT_REVIEWS_FAIL =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
Suggestion,
} from '../../../model/product-search.model';
import { SearchConfig } from '../../model/search-config';
import { ErrorAction } from '@spartacus/core';
import { ErrorAction } from '../../../model/index';

export const SEARCH_PRODUCTS = '[Product] Search Products';
export const SEARCH_PRODUCTS_FAIL = '[Product] Search Products Fail';
Expand Down
2 changes: 1 addition & 1 deletion projects/core/src/product/store/actions/product.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { EntityLoaderMeta } from '../../../state/utils/entity-loader/entity-load
import { EntityScopedLoaderActions } from '../../../state/utils/scoped-loader/entity-scoped-loader.actions';
import { ProductScope } from '../../model/product-scope';
import { PRODUCT_DETAIL_ENTITY } from '../product-state';
import { ErrorActionType } from '@spartacus/core';
import { ErrorActionType } from '../../../model/index';

export const LOAD_PRODUCT = '[Product] Load Product Data';
export const LOAD_PRODUCT_FAIL = '[Product] Load Product Data Fail';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { catchError, map, mergeMap } from 'rxjs/operators';
import { ProductReferencesConnector } from '../../connectors/references/product-references.connector';
import { ProductActions } from '../actions/index';
import { LoggerService } from '../../../logger';
import { tryNormalizeHttpError } from '@spartacus/core';
import { tryNormalizeHttpError } from '../../../util/try-normalize-http-error';

@Injectable()
export class ProductReferencesEffects {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
GlobalMessageType,
} from '../../../global-message/index';
import { LoggerService } from '../../../logger';
import { tryNormalizeHttpError } from '@spartacus/core';
import { tryNormalizeHttpError } from '../../../util/try-normalize-http-error';

@Injectable()
export class ProductReviewsEffects {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import { Action } from '@ngrx/store';
import { BaseSite } from '../../../model/misc.model';
import { ErrorAction, ErrorActionType } from '@spartacus/core';
import { ErrorAction, ErrorActionType } from '../../../model/index';

export const LOAD_BASE_SITE = '[Site-context] Load BaseSite';
export const LOAD_BASE_SITE_FAIL = '[Site-context] Load BaseSite Fail';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import { Action } from '@ngrx/store';
import { Currency } from '../../../model/misc.model';
import { ErrorAction, ErrorActionType } from '@spartacus/core';
import { ErrorAction, ErrorActionType } from '../../../model/index';

export const LOAD_CURRENCIES = '[Site-context] Load Currencies';
export const LOAD_CURRENCIES_FAIL = '[Site-context] Load Currencies Fail';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import { Action } from '@ngrx/store';
import { Language } from '../../../model/misc.model';
import { ErrorAction, ErrorActionType } from '@spartacus/core';
import { ErrorAction, ErrorActionType } from '../../../model/index';

export const LOAD_LANGUAGES = '[Site-context] Load Languages';
export const LOAD_LANGUAGES_FAIL = '[Site-context] Load Languages Fail';
Expand Down
2 changes: 1 addition & 1 deletion projects/core/src/state/utils/loader/loader.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { Action } from '@ngrx/store';
import { ErrorAction, ErrorActionType } from '@spartacus/core';
import { ErrorAction, ErrorActionType } from '../../../model/index';

export const LOADER_LOAD_ACTION = '[LOADER] LOAD';
export const LOADER_FAIL_ACTION = '[LOADER] FAIL';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
entityResetMeta,
entitySuccessMeta,
} from '../entity-loader/entity-loader.action';
import { ErrorAction, ErrorActionType } from '@spartacus/core';
import { ErrorAction, ErrorActionType } from '../../../model/index';

export namespace EntityScopedLoaderActions {
export interface EntityScopedLoaderMeta extends EntityLoaderMeta {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { Action } from '@ngrx/store';
import { ErrorAction } from '@spartacus/core';
import { ErrorAction } from '../../../model/index';

export const LOAD_BILLING_COUNTRIES = '[User] Load Billing Countries';
export const LOAD_BILLING_COUNTRIES_FAIL = '[User] Load Billing Countries Fail';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
SUBSCRIBE_CUSTOMER_COUPON_PROCESS_ID,
UNSUBSCRIBE_CUSTOMER_COUPON_PROCESS_ID,
} from '../user-state';
import { ErrorAction, ErrorActionType } from '@spartacus/core';
import { ErrorAction, ErrorActionType } from '../../../model/index';

export const LOAD_CUSTOMER_COUPONS = '[User] Load Customer Coupons';
export const LOAD_CUSTOMER_COUPONS_FAIL = '[User] Load Customer Coupons Fail';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import { Action } from '@ngrx/store';
import { Country } from '../../../model/address.model';
import { ErrorAction, ErrorActionType } from '@spartacus/core';
import { ErrorAction, ErrorActionType } from '../../../model/index';

export const LOAD_DELIVERY_COUNTRIES = '[User] Load Delivery Countries';
export const LOAD_DELIVERY_COUNTRIES_FAIL =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
UPDATE_NOTIFICATION_PREFERENCES_PROCESS_ID,
} from '../user-state';
import { NotificationPreference } from '../../../model/notification-preference.model';
import { ErrorActionType } from '@spartacus/core';
import { ErrorActionType } from '../../../model/index';

export const LOAD_NOTIFICATION_PREFERENCES =
'[User] Load Notification Preferences';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { PaymentDetails } from '../../../model/payment.model';
import { StateUtils } from '../../../state/utils/index';
import { USER_PAYMENT_METHODS } from '../user-state';
import { ErrorActionType } from '@spartacus/core';
import { ErrorActionType } from '../../../model/index';

export const LOAD_USER_PAYMENT_METHODS = '[User] Load User Payment Methods';
export const LOAD_USER_PAYMENT_METHODS_FAIL =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
EntityLoaderResetAction,
EntitySuccessAction,
} from '../../../state/utils/entity-loader/entity-loader.action';
import { ErrorActionType } from '@spartacus/core';
import { ErrorActionType } from '../../../model/index';

export const LOAD_PRODUCT_INTERESTS = 'Load Product Interests';
export const LOAD_PRODUCT_INTERESTS_FAIL = 'Load Product Interests Fail';
Expand Down
2 changes: 1 addition & 1 deletion projects/core/src/user/store/actions/regions.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Action } from '@ngrx/store';
import { Region } from '../../../model/address.model';
import { StateUtils } from '../../../state/utils/index';
import { REGIONS } from '../user-state';
import { ErrorActionType } from '@spartacus/core';
import { ErrorActionType } from '../../../model/index';

export const LOAD_REGIONS = '[User] Load Regions';
export const LOAD_REGIONS_SUCCESS = '[User] Load Regions Success';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { Address } from '../../../model/address.model';
import { StateUtils } from '../../../state/utils/index';
import { USER_ADDRESSES } from '../user-state';
import { ErrorActionType } from '@spartacus/core';
import { ErrorActionType } from '../../../model/index';

export const LOAD_USER_ADDRESSES = '[User] Load User Addresses';
export const LOAD_USER_ADDRESSES_FAIL = '[User] Load User Addresses Fail';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
USER_CONSENTS,
WITHDRAW_CONSENT_PROCESS_ID,
} from '../user-state';
import { ErrorActionType } from '@spartacus/core';
import { ErrorActionType } from '../../../model/index';

export const LOAD_USER_CONSENTS = '[User] Load User Consents';
export const LOAD_USER_CONSENTS_SUCCESS = '[User] Load User Consents Success';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { CostCenter } from '../../../model/org-unit.model';
import { StateUtils } from '../../../state/utils/index';
import { USER_COST_CENTERS } from '../user-state';
import { ErrorActionType } from '@spartacus/core';
import { ErrorActionType } from '../../../model/index';

export const LOAD_ACTIVE_COST_CENTERS = '[User] Load Active CostCenters';
export const LOAD_ACTIVE_COST_CENTERS_FAIL =
Expand Down
8 changes: 3 additions & 5 deletions projects/core/src/util/try-normalize-http-error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
*/

import { HttpErrorResponse } from '@angular/common/http';
import {
HttpErrorModel,
LoggerService,
normalizeHttpError,
} from '@spartacus/core';
import { HttpErrorModel } from '../model';
import { LoggerService } from '../logger';
import { normalizeHttpError } from './normalize-http-error';

export function tryNormalizeHttpError(
error: HttpErrorResponse | HttpErrorModel | any,
Expand Down

0 comments on commit 810956d

Please sign in to comment.