Skip to content
This repository has been archived by the owner on Dec 23, 2024. It is now read-only.

PayPayErrorをライブラリの使用方法がおかしい時にだけ出す #18

Closed
EdamAme-x opened this issue Jan 20, 2024 · 3 comments
Labels
wontfix This will not be worked on

Comments

@EdamAme-x
Copy link
Owner

現状リクエストが失敗した場合にも出てしまっている。 wontfix This will not be worked on

@EdamAme-x EdamAme-x added the wontfix This will not be worked on label Jan 20, 2024
@EdamAme-x
Copy link
Owner Author

例えばここ

async getBalance(): Promise<ResponseBalance> {
    if (!this.isLogged()) {
      throw new PayPayError('Do not logged in', 2).fire()
    }

    const { response, result } = await this.baseFetch(
      'https://www.paypay.ne.jp/app/v1/bff/getBalanceInfo',
      {
        method: 'GET',
      }
    )

    if (!response.ok) {
      throw new PayPayError('Get balance failed', 1).fire()
    }

    return parseBalanceContext(result)
  }async getBalance(): Promise<ResponseBalance> {
    if (!this.isLogged()) {
      throw new PayPayError('Do not logged in', 2).fire()
    }

    const { response, result } = await this.baseFetch(
      'https://www.paypay.ne.jp/app/v1/bff/getBalanceInfo',
      {
        method: 'GET',
      }
    )

    if (!response.ok) {
      throw new PayPayError('Get balance failed', 1).fire()
    }

    return parseBalanceContext(result)
  }

@EdamAme-x
Copy link
Owner Author

ここの

if (!response.ok) {
      throw new PayPayError('Get balance failed', 1).fire()
}

{
     success: false,
     ...,
     raw: ...
}

の形式で返すべき

@EdamAme-x
Copy link
Owner Author

#19

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant