inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

React로 NodeBird SNS 만들기

리덕스 사가 회원가입 에러 관련 질문

해결된 질문

262

Jiyeol Lee

작성한 질문수 23

0

콘솔 창에서 "에러에러에러" 에러 메시지는 잘 확인 되는데, 정작 리덕스 state인 signUpErroReason에는 빈 객체만 들어갑니다. 어떻게 된 일인지 궁금합니다!

function* signUp() {
	try {
		// yield call(signUpAPI);
		yield delay(2000);
		throw new Error("에러에러에러");
		yield put({
			// put은 dispatch 동일
			type: SIGN_UP_SUCCESS
		});
	} catch (e) {
		// loginAPI 실패
		console.error(e);

		yield put({
			type: SIGN_UP_FAILURE,
			error: e
		});
	}
}

react javascript

답변 5

1

제로초(조현영)

네, state로 관리합니다. 객체일 필요는 없어서 message만 관리하기도 합니다.

0

Jiyeol Lee

네 action.error.message로 하니까 "에러에러에러"가 들어가는게 리덕스 데브툴로 확인이 되네요 감사합니다. 그런데 실무에서는 그럼 에러 객체?(이 표현이 맞는지 모르겠지만) 자체를 리덕스 state로 관리를 보통 하는건가요?

0

제로초(조현영)

근데 저기 데브툴에서 빈 객체로 나오는데 실제로도 빈 객체인가요? 아닐겁니다. action.error.message하면 에러 메시지가 나올거에요

0

Jiyeol Lee

 case SIGN_UP_FAILURE: {
      return {
        ...state,
        isSigningUp: false,
        signUpErrorReason: action.error
      };
   }

제로초님이 짜신 코드와 동일하게 되어있습니다.

  1. Error: 에러에러에러 at signUp$ (http://localhost:3000/_next/static/development/pages/_app.js?ts=1569375119032:163006:17) at tryCatch (http://localhost:3000/_next/static/runtime/main.js?ts=1569375119032:11441:40) at Generator.invoke [as _invoke] (http://localhost:3000/_next/static/runtime/main.js?ts=1569375119032:11667:22) at Generator.prototype.<computed> [as next] (http://localhost:3000/_next/static/runtime/main.js?ts=1569375119032:11493:21) at next (http://localhost:3000/_next/static/development/pages/_app.js?ts=1569375119032:6367:29) at currCb (http://localhost:3000/_next/static/development/pages/_app.js?ts=1569375119032:6461:7)
    1. message"에러에러에러"
    2. stack"Error: 에러에러에러↵ at signUp$ (http://localhost:3000/_next/static/development/pages/_app.js?ts=1569375119032:163006:17)↵ at tryCatch (http://localhost:3000/_next/static/runtime/main.js?ts=1569375119032:11441:40)↵ at Generator.invoke [as _invoke] (http://localhost:3000/_next/static/runtime/main.js?ts=1569375119032:11667:22)↵ at Generator.prototype.<computed> [as next] (http://localhost:3000/_next/static/runtime/main.js?ts=1569375119032:11493:21)↵ at next (http://localhost:3000/_next/static/development/pages/_app.js?ts=1569375119032:6367:29)↵ at currCb (http://localhost:3000/_next/static/development/pages/_app.js?ts=1569375119032:6461:7)"

console.dir(e)는 위와 같이 출력되네요.

0

제로초(조현영)

SIGN_UP_FAILURE 액션이 어떻게 되어있나요? 그리고 console.dir(e);도 한 번 해보세요.

next 10 이상에서는 redux dev tool 구동이 안되나요?

0

272

1

세션 갱신 문의 건

0

484

7

배포 진행 후 Highlight updates components render 표시

0

445

1

똑같은 기능을 하는 테이블

0

448

4

관계형

0

312

2

프론트 서버를 이용하지 않는경우

1

299

3

인피니트 스크롤링 사용시 오류

0

278

0

계속 이런에러가 떠서 해결하기는 했는데 어떤 의미인지 모르겠습니다.

0

435

2

req.user가 언제 생성되나요??

0

330

2

Cannot read property 'id' of null 에러

0

333

1

리트윗한 게시글 불러오는 sequelize

0

252

1

result.data에서 images인 이유

0

281

2

takeLatest에 대한 질문입니다.

1

342

2

프론트에서 express를 사용하지 않을때 동적라우팅

0

501

6

getInitialProps가 클라이언트에서 수행되는 이유?

0

258

1

리로드하면 팔로우 언팔로우 값이 초기화 되는 문제입니다.

0

445

2

스타일드 컴포넌트와 className을 통한 스타일 적용의 차이에 대해 궁금합니다

0

585

2

할인 쿠폰 사용이 안되는되요 (848-f9af83f183e3)

0

365

1

nodejs mvc 패턴

0

976

4

사용하고 보니, 람다 구성이 궁금합니다!

0

266

1

제로초님

0

445

1

새로고침 로그인 풀림 문제.

0

247

1

안녕하세요. 강의 너무 감사합니다

0

157

1

제로초님

0

170

1