-
Notifications
You must be signed in to change notification settings - Fork 17
refactor: elaborate connector error messages #135
base: master
Are you sure you want to change the base?
Conversation
bab33b7
to
dfdf63c
Compare
@@ -148,7 +150,7 @@ describe('Facebook connector', () => { | |||
set: jest.fn(), | |||
get: jest.fn(), | |||
}) | |||
).rejects.toMatchError(new ConnectorError(ConnectorErrorCodes.SocialAccessTokenInvalid)); | |||
).rejects.toMatchError(new ConnectorError(ConnectorErrorCodes.General, JSON.stringify(''))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need manually stringify here?
@@ -126,7 +126,7 @@ describe('getUserInfo', () => { | |||
const connector = await createConnector({ getConfig }); | |||
await expect( | |||
connector.getUserInfo({ code: 'code' }, jest.fn(), { set: jest.fn(), get: jest.fn() }) | |||
).rejects.toMatchError(new ConnectorError(ConnectorErrorCodes.SocialAccessTokenInvalid)); | |||
).rejects.toMatchError(new ConnectorError(ConnectorErrorCodes.General, JSON.stringify(''))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
assert( | ||
accessToken, | ||
new ConnectorError(ConnectorErrorCodes.SocialAuthCodeInvalid, 'accessToken is missing.') | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually the access token logic is very repetitive as far as i can see. should be extracted into a function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this check is necessary for almost all social connectors. We can extract to @logto/connector-kit and seems it is not a blocker of GA.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
created issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check LOG-5808
300b075
to
ef9f1c4
Compare
ef9f1c4
to
241ed48
Compare
Summary
elaborate connector error messages
Testing
UTs.
Checklist
.changset-staged
OR