Skip to content

Commit ccffb5c

Browse files
committed
Remove noisy comment
1 parent bf095b6 commit ccffb5c

2 files changed

Lines changed: 50 additions & 4 deletions

File tree

backend/FwLite/FwLiteShared/Auth/OAuthClient.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,10 +291,6 @@ internal enum SilentAuthFailureOutcome
291291
_ => SilentAuthFailureOutcome.KeepCachedCredentials,
292292
};
293293

294-
//Classifies AcquireTokenInteractive failures by exception type, not message/code: MSAL's "oidc_failure"
295-
//is an unpublished string literal, whereas the inner HttpRequestException is a reliable offline signal.
296-
//A cancel is treated as a cancel regardless of connectivity; offline with a warm OIDC cache also surfaces
297-
//here, but the user has already seen the browser fail. null means rethrow (global handler surfaces it).
298294
internal static LoginResult? ClassifyInteractiveLoginFailure(Exception e) => e switch
299295
{
300296
MsalServiceException { InnerException: HttpRequestException } => LoginResult.Offline,
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import {describe, expect, it} from 'vitest';
2+
3+
import {processErrorIntoDetails} from './global-errors';
4+
5+
describe('processErrorIntoDetails', () => {
6+
it('splits a .NET error at the first stack frame', () => {
7+
const message = [
8+
'System.InvalidOperationException: Everything is broken.',
9+
' at FwLiteShared.Services.Foo.Bar(String x)',
10+
' at FwLiteShared.Services.Foo.Baz()',
11+
].join('\n');
12+
13+
const {message: title, detail} = processErrorIntoDetails({message, error: null});
14+
15+
expect(title).toBe('System.InvalidOperationException: Everything is broken.');
16+
expect(detail).toContain('at FwLiteShared.Services.Foo.Bar(String x)');
17+
});
18+
19+
it('splits at the inner-exception marker that precedes the outer frames, keeping a wrapped error\'s title short', () => {
20+
// MSAL wrapping an Android network failure: the whole " ---> " cascade comes before the first managed frame
21+
const message = [
22+
'Microsoft.Identity.Client.MsalServiceException: Failed to retrieve OIDC configuration. See inner exception.',
23+
' ---> System.Net.Http.HttpRequestException: Connection failure',
24+
' ---> Java.Net.UnknownHostException: Unable to resolve host',
25+
' at Java.Interop.JniEnvironment.InstanceMethods.CallVoidMethod()',
26+
].join('\n');
27+
28+
const {message: title, detail} = processErrorIntoDetails({message, error: null});
29+
30+
expect(title).toBe('Microsoft.Identity.Client.MsalServiceException: Failed to retrieve OIDC configuration. See inner exception.');
31+
expect(detail).toContain('---> System.Net.Http.HttpRequestException: Connection failure');
32+
});
33+
34+
it('keeps the whole message as the title when there is no .NET stack', () => {
35+
const {message: title, detail} = processErrorIntoDetails({message: 'plain error', error: null});
36+
37+
expect(title).toBe('plain error');
38+
expect(detail).toBeUndefined();
39+
});
40+
41+
it('does not repeat a JS Error message in both title and detail', () => {
42+
const error = new Error('boom');
43+
44+
const {message: title, detail} = processErrorIntoDetails({message: 'Uncaught Error: boom', error});
45+
46+
expect(title).toBe('boom');
47+
expect(detail).not.toContain('boom');
48+
expect(detail).toContain('at ');
49+
});
50+
});

0 commit comments

Comments
 (0)