mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-14 06:02:36 +03:00
Added text handling in fetchWithValidation
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@orionprotocol/sdk",
|
||||
"version": "0.5.13",
|
||||
"version": "0.5.14",
|
||||
"description": "Orion Protocol SDK",
|
||||
"main": "./lib/esm/index.js",
|
||||
"module": "./lib/esm/index.js",
|
||||
|
||||
@@ -84,6 +84,9 @@ export default async function fetchWithValidation<DataOut, DataIn, ErrorOut, Err
|
||||
});
|
||||
}
|
||||
|
||||
const textPayload = schema.safeParse(text);
|
||||
if (textPayload.success) return ok(textPayload.data);
|
||||
|
||||
const safeParseJson = fromThrowable(JSON.parse, (e) => {
|
||||
if (e instanceof Error) {
|
||||
return err({
|
||||
|
||||
Reference in New Issue
Block a user