# 20210304(목)

## 2021-03-04

### 1. 학습 날짜

* 2021-03-04

### 2. 학습 시간

* 09:00 \~ 24:00

### 3. 학습 범위 및 주제

* 백본 view, model, collection
* 루비온레일즈

### 4. 학습 목표

* PR 수정 및 PR 확인

### 5. 학습 정리

* [custom exception](https://simian114.gitbook.io/blog/undefined/rubyonrails/exception)

### 6. 상세 학습 내용

* 하루종일 PR 관련 작업만 주구장창 진행했다....&#x20;
* 와중에 정리한 내용은 `custom exception` 을 만드는 방법...
* 일단 루비에서 excep 을 사용하기 위해서는 아래처럼 하면 된다.

```
begin

...

rescue SOMETHING => e

...

end
```

여기서 SOMETHING 에 해당하는 exception 클래스를 만들 수 있는데, 만든 이유는 `StandardError` 는 인자를 하나만 줄 수 있기 때문이다. 나같은 경우는 message 와 status\_code 두 가지 정보를 주고 싶었기 때문에 커스텀을 만들어야 했다.

우선 만든 class 파일을 둘 곳을 정해야했는데, 인터넷을 보니 `app/errors` 에 만들라고 해서 해당하는 곳에 이름 규칙을 지켜 파일을 만들었다. 이후에는 `StandardError` 를 상속받은 다음 인자를 두개 받는 `initialize` 를 만들면 된다...

### 7. 오늘 학습 내용에 대한 개인적인 총평

* 너무 지친다... 즐거운 코딩이 안된다..

### 8. 다음 학습 계획

* war\_request\_create PR 마무리


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://simian114.gitbook.io/blog/undefined-1/diary/2021/march/20210304.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
