Skip to content

Commit

Permalink
return empty string if no reader can be made from the readable stream
Browse files Browse the repository at this point in the history
  • Loading branch information
raejohanek committed Oct 28, 2024
1 parent af719c8 commit 50c8351
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/components/SignInButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,13 @@ export const SignInButton = (props: SignInButtonProps) => {

const streamToString = async (error: HttpError): Promise<string> => {
const reader = error.body?.getReader();
let result = '';
const decoder = new TextDecoder('utf-8');

if (!reader) {
return 'Error message not readable.';
return result;
}

const decoder = new TextDecoder('utf-8');
let result = '';

// eslint-disable-next-line no-constant-condition
while (true) {
const { done, value } = await reader.read();
Expand Down

0 comments on commit 50c8351

Please sign in to comment.