[FSMCPB-167858] Extend refresh-token samples with ERROR event handling#148
Open
VGio wants to merge 1 commit into
Open
[FSMCPB-167858] Extend refresh-token samples with ERROR event handling#148VGio wants to merge 1 commit into
VGio wants to merge 1 commit into
Conversation
Add SHELL_EVENTS.ERROR handler to all three refresh-token samples (JS, TypeScript, UI5) as required by the fsm-shell documentation: notify the user on error, wait before retrying, and stop after MAX_RETRIES (3) to avoid excessive API calls that could result in extension deactivation. Changes per sample: - shell-sdk.service: subscribe to SHELL_EVENTS.ERROR in init(), emit error messages via a new errorSubject (BehaviorSubject), retry REQUIRE_AUTHENTICATION with a 5s delay, cap at 3 retries - shell-sdk.service: expose subscribeToError() for consumers - index.js / index.ts / View1.controller.ts: subscribe to error stream and display the message to the user - index.html (JS + TS): add #error-info element for error display - styles.css (JS + TS): add .error-message styling - Add Vitest unit tests for the error handling logic (JS + TS samples); add vitest dev dependency and "test" script to both package.json files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SHELL_EVENTS.ERRORhandling to all three refresh-token samples (JavaScript, TypeScript, SAP UI5) as required by the fsm-shell documentationREQUIRE_AUTHENTICATIONto avoid hammering the ShellChanges
All three samples (
shell-sdk.service.js/ts)SHELL_EVENTS.ERRORlistener ininit()errorSubject(BehaviorSubject) andsubscribeToError()methodJS + TS samples (
index.js/index.ts)subscribeToError()and display the message in a#error-infoelement.error-message) to CSS#error-infodiv to HTMLUI5 sample (
View1.controller.ts)subscribeToError()and bind the message to the existing/errorMessagemodel propertyTests
vitestdev dependency and"test"script to bothpackage.jsonfilesTest plan
npm testpasses inrefresh-token-sample-js(5/5)npm testpasses inrefresh-token-sample-ts(5/5)npx tsc --noEmitpasses inrefresh-token-sample-tsnpm run ts-typecheckpasses inrefresh-token-sample-ui5Closes FSMCPB-167858