Error thrown is a String
@miachillgood がすでに取り組んでいます。
2026年6月19日 から。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 25/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- nodejs, typescript
- 領域
- api
調査の方向性
Start with the repro: xero.setTokenSet() with an expired token, then xero.accountingApi.getOrganisations() in a try/catch. The thrown value is a plain string holding the 401 response, not an Error. Check the open PRs #812 and #816 first, since they may already address this. Done means the SDK throws an Error carrying the status code, message and response body, and the other string-throw paths are covered.
索引モデルが issue の本文から書いたものです。
説明
- Version 10.0.0 (latest at time of submission)
Step to repro:
If the token set is expired (we should obviously call const ts = await xero.refreshToken();) the error throw in a String instead of an Error object
import { XeroClient } from 'xero-node';
const xero = new XeroClient({
clientId: process.env.XERO_CLIENT_ID,
clientSecret: process.env.XERO_CLIENT_SECRET,
redirectUris: ['.....'],
scopes: [
'openid',
'profile',
'email',
'accounting.transactions',
'offline_access',
'accounting.settings',
'accounting.contacts',
],
state: '...',
});
await xero.initialize();
const tenantId = '22.....5e';
xero.setTokenSet({"id_token":"ey...Q","access_token":"ey...w","expires_at":1740040370,"token_type":"Bearer","refresh_token":"Mk.....","scope":"email profile openid accounting.settings accounting.transactions accounting.contacts offline_access"});
try {
const { body: { organisations } } = await xero.accountingApi.getOrganisations(tenantId);
console.log(organisations);
} catch (err) {
console.log('ERR', typeof err, err);
}
Output:
ERR string {"response":{"statusCode":401,"body":{"Type":null,"Title":"Unauthorized","Status":401,"Detail":"TokenExpired: token expired at 02/20/2025 08:32:50","Instance":"f4a9c0c2-ab46-462c-b70b-9999612e6aa9","Extensions":{}},"headers":{"content-type":"application/json","content-length":"177","server":"nginx","www-authenticate":"Bearer error=invalid_token","xero-correlation-id":"f4a9c0c2-ab46-462c-b70b-9999612e6aa9","expires":"Thu, 20 Feb 2025 12:09:06 GMT","cache-control":"max-age=0, no-cache, no-store","pragma":"no-cache","date":"Thu, 20 Feb 2025 12:09:06 GMT","connection":"close","x-client-tls-ver":"tls1.3","set-cookie":"ak....jQ==; Domain=.xero.com; Path=/; Expires=Thu, 20 Feb 2025 14:09:06 GMT; Max-Age=7200; SameSite=None; Secure"},"request":{"url":{"protocol":"https:","port":443,"host":"api.xero.com","path":"/api.xro/2.0/Organisation"},"headers":{"accept":"application/json","content-type":"application/json","user-agent":"xero-node-10.0.0","xero-tenant-id":"22......5e","authorization":"Bearer ey...Jw","content-length":"2","accept-encoding":"gzip, compress, deflate, br","host":"api.xero.com"},"method":"GET"}},"body":{"Type":null,"Title":"Unauthorized","Status":401,"Detail":"TokenExpired: token expired at 02/20/2025 08:32:50","Instance":"f4a9c0c2-ab46-462c-b70b-9999612e6aa9","Extensions":{}}
There are other cases where the error is a String
It should not throw an error as a string because it's not practical, it should be an Error object with ideally a status code (401, 403, ..), a message, and more data if needed
- 主要言語
- TypeScript
- スター
- 264
- フォーク
- 177
- 平均マージ
- 10時間 5分
- マージ済み PR(30日)
- 5
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
XeroAPI/xero-node のほかの issue
-
`getClientCredentialsToken()` sends `scopes` (comma-joined) instead of the OAuth `scope` parameterオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
難易度 3/5 半日 初心者へのやさしさ 55/100
-
TrackingOptionId value missing from accountingApi.getInvoices()対応中かも @miachillgood が 152 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 18/100
-
BankTransaction type is missing the batchPayment object.対応中かも @miachillgood が 171 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 22/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 25/100
XeroAPI/xero-node の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
super-productivity/super-productivity#12128 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
A docs change can fail pnpm check, because outreach lint and gen:types both write .astro/ at once対応中かも @2389400626lh-ops が今日担当しました。 オープンArea: Infrastructure Area: Outreach Bug Difficulty: Low Good First Issue Priority: Low
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
DouglasNeuroInformatics/OpenDataCapture#1956 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 72/100
justyns/silverbullet-ai#199 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
spartan-ng/spartan#1931 ·
メンテナーはふだん 2 日以内に返信