codestates / codestates/conimals

[정새얀] 220610 Error - Handling

Open
#122 0 comments 0 reactions 0 assignees View on GitHub
complete
Dominant language
JavaScript
Stars
3
Forks
5
PR merge metrics
No merged PRs in 30d

Description

> 해결된 에러라면 라벨에 'Complete' 를 달아주세요.
> 미해결된 에러라면 라벨을 'In progress' 로 변경해주세요.

### 어떤 에러인가요?
- 포스트맨으로 사용자 정보를 가져오는 요청을 보낼때 나오는 쿼리 에러

### 에러 메시지
```bash
throw new sequelizeErrors.QueryError("The argument passed to findAll must be an options object, use findByPk if you wish to pass a single primary key value");
^
QueryError [SequelizeQueryError]: The argument passed to findAll must be an options object, use findByPk if you wish to pass a single primary key value
```

### 에러 핸들링 방법
```js
await posts.findAll(uploads = uploads.map(el => el.get({ plain: true })));
```
과 같은 형식으로 작성했을 때, findAll()에 맞는 형식이 아니어서 나오는 에러문이었다.

### 에러 핸들링을 위해 참고한 레퍼런스 링크

[에러](https://stackoverflow.com/questions/50087475/the-argument-passed-to-findone-must-be-an-options-object-use-findbyid-if-you-wi)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.