Skip to content

Commit

Permalink
Use res.text() over res.json() for errors
Browse files Browse the repository at this point in the history
  • Loading branch information
aryzing committed Nov 25, 2024
1 parent e12659c commit fe9f794
Show file tree
Hide file tree
Showing 17 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/stacks-api/accounts/balances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export async function balances(
data: {
status: res.status,
statusText: res.statusText,
bodyParseResult: await safePromise(res.json()),
bodyText: await safePromise(res.text()),
},
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/stacks-api/accounts/latest-nonce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export async function latestNonce(
endpoint,
status: res.status,
statusText: res.statusText,
bodyParseResult: await safePromise(res.json()),
bodyText: await safePromise(res.text()),
},
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/stacks-api/blocks/get-block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export async function getBlock(
data: {
status: res.status,
statusText: res.statusText,
bodyParseResult: await safePromise(res.json()),
bodyText: await safePromise(res.text()),
},
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/stacks-api/faucets/stx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export async function stx(opts: Args): Promise<Result<any>> {
data: {
status: res.status,
statusText: res.statusText,
bodyParseResult: await safePromise(res.json()),
bodyText: await safePromise(res.text()),
},
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/stacks-api/info/core-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export async function coreApi(
data: {
status: res.status,
statusText: res.statusText,
bodyParseResult: await safePromise(res.json()),
bodyText: await safePromise(res.text()),
},
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/stacks-api/proof-of-transfer/cycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export async function cycle(
endpoint,
status: res.status,
statusText: res.statusText,
bodyParseResult: await safePromise(res.json()),
bodyText: await safePromise(res.text()),
},
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/stacks-api/proof-of-transfer/cycles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export async function cycles(args: Args): Promise<Result<CyclesResponse>> {
endpoint,
status: res.status,
statusText: res.statusText,
bodyParseResult: await safePromise(res.json()),
bodyText: await safePromise(res.text()),
},
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/stacks-api/proof-of-transfer/signers-in-cycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export async function signersInCycle(
endpoint,
status: res.status,
statusText: res.statusText,
bodyParseResult: await safePromise(res.json()),
bodyText: await safePromise(res.text()),
},
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export async function stackersForSignerInCycle(
endpoint,
status: res.status,
statusText: res.statusText,
bodyParseResult: await safePromise(res.json()),
bodyText: await safePromise(res.text()),
},
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/stacks-api/stacking-pool/members.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export async function members(args: Args): Promise<Result<MembersResponse>> {
data: {
status: res.status,
statusText: res.statusText,
bodyParseResult: await safePromise(res.json()),
bodyText: await safePromise(res.text()),
},
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/stacks-api/transactions/address-transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export async function addressTransactions(
data: {
status: res.status,
statusText: res.statusText,
bodyParseResult: await safePromise(res.json()),
bodyText: await safePromise(res.text()),
},
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/stacks-api/transactions/get-transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export async function getTransaction(args: Args): Promise<Result<Transaction>> {
response: {
status: res.status,
statusText: res.statusText,
body: await safePromise(res.json()),
bodyText: await safePromise(res.text()),
},
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/stacks-api/transactions/mempool-transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export async function mempoolTransactions(
data: {
status: res.status,
statusText: res.statusText,
bodyParseResult: await safePromise(res.json()),
bodyText: await safePromise(res.text()),
},
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/stacks-rpc-api/fees/estimate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export async function estimate(args: Args): Promise<Result<Response>> {
status: res.status,
statusText: res.statusText,
endpoint,
bodyParseResult: await safePromise(res.text()),
bodyText: await safePromise(res.text()),
},
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/stacks-rpc-api/pox/pox-details.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export async function poxDetails(
data: {
status: res.status,
statusText: res.statusText,
bodyParseResult: await safePromise(res.json()),
bodyText: await safePromise(res.text()),
},
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/stacks-rpc-api/smart-contracts/map-entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export async function mapEntry(args: Args): Promise<Result<MapEntryResponse>> {
status: res.status,
statusText: res.statusText,
endpoint,
bodyParseResult: await safePromise(res.text()),
bodyText: await safePromise(res.text()),
},
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/stacks-rpc-api/smart-contracts/read-only.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export async function readOnly(args: Args): Promise<Result<ReadOnlyResponse>> {
data: {
status: res.status,
statusText: res.statusText,
bodyParseResult: await safePromise(res.json()),
bodyText: await safePromise(res.text()),
},
});
}
Expand Down

0 comments on commit fe9f794

Please sign in to comment.