Skip to content

Fix: Fix typescript client#288

Open
SnowSuno wants to merge 2 commits into
sparcs-kaist:masterfrom
SnowSuno:master
Open

Fix: Fix typescript client#288
SnowSuno wants to merge 2 commits into
sparcs-kaist:masterfrom
SnowSuno:master

Conversation

@SnowSuno

@SnowSuno SnowSuno commented May 8, 2022

Copy link
Copy Markdown
Member

summary:

  • Add missing type definitions
  • Minor changes to error handling behavior

breaking changes:

  • _postData(): Throw UNKNOWN_ERROR when caught error is not type of AxiosError
  • getUserInfo(): Bubble error instead of returning it directly

summary:
- Add missing type definitions
- Minor changes to error handling behavior

breaking changes:
- _postData(): Throw UNKNOWN_ERROR when caught error is not type of AxiosError
- getUserInfo(): Bubble error instead of returning it directly
private readonly DOMAIN: string;

constructor(clientId, secretKey, isBeta = false, serverAddr = "") {
constructor(clientId: string, secretKey: string, isBeta = false, serverAddr = "") {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isBeta, serverAddr도 type 적어주세요👍

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default value를 이와 같이 주면 각각 boolean, string으로 type inference가 되어서 타입 명시는 안 해줬던 것 같네요.
명시적으로 적어주는 것도 나쁘지 않을 것 같긴 해요

Comment thread client/sparcsssov2-node.ts Outdated
throw new Error("NO_PERMISSION");
} else if (err.response.status !== 200) {
throw new Error("UNKNOWN_ERROR");
if (err instanceof AxiosError) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@SnowSuno

Copy link
Copy Markdown
Member Author

후후 1년만에 답글달기

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants