Skip to content

Commit 894a017

Browse files
refactor: simplify error handling in getData function
1 parent 0c861e0 commit 894a017

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/lib/request.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ export async function getData(instance: AxiosInstance, url: string, data?: any)
2828
if (response && response.data) {
2929
return response.data;
3030
} else {
31-
throw Error(JSON.stringify(response));
31+
throw response;
3232
}
3333
} catch (err: any) {
34-
throw new Error(`${err.message || JSON.stringify(err)}`);
34+
throw err;
3535
}
3636
}

0 commit comments

Comments
 (0)