anitab-org / anitab-org/mentorship-backend

Improvement: Refactor code to use dict.get() method

未关闭
#1,065 11 条评论 0 个 reaction 已指派 1 人 已被 @aakankshaagr 认领 在 GitHub 查看
Category: Coding Type: Enhancement
主要语言
Python
星标
200
派生
449
PR 合并指标
30 天内没有已合并 PR

描述

## Description
As a developer,
I need code to be consistent and error-free.

## Mocks
https://github.com/anitab-org/mentorship-backend/blob/d52d77706aad4a486f2417419bb4c4c6d2ace3a6/app/api/dao/user.py#L42-L46
For example this can be replaced by the get method i.e. `data.get("KEY", "DEFAULT_VALUE")` to avoid KeyError

## Acceptance Criteria
### Update [Required]
- [ ] Use get method in all code to avoid the raise of KeyError
- [ ] Handle exceptions for default value

## Definition of Done
- [ ] All of the required items are completed.
- [ ] Approval by 1 mentor.

## Estimation
2 hours

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。