Skip to content

[refactor] 全体的にエラーハンドリング漏れの修正 - #150

Merged
static-fuji merged 18 commits into
developfrom
fix/error-handling-improvements
Dec 15, 2025
Merged

static-fuji merged 18 commits into
developfrom
fix/error-handling-improvements

Conversation

@Justhiro55

@Justhiro55 Justhiro55 commented Jun 11, 2025 •

Copy link
Copy Markdown
Collaborator

概要

エラーハンドリングを中心に,全体的に見直して修正しました.
使われていなかった戻り値のエラー処理を追加して,処理が途中で失敗しても気付きやすくしました.
追加で,CIも追加しました

変更点

  • utils.Validate や auth.IssueUserToken のエラー処理を追加
  • HTTPレスポンスやエラーメッセージの見直し
  • workID の取得を chi.URLParam に変更
  • commentRepositoryImpl の戻り値型を明示
  • Usecace を UseCase に修正(タイポ修正)
  • userID.(string)の入力値にnil等が入った際にパニックが発生するケースの修正
  • CIの追加:ビルドできるかの最低限

@Justhiro55
Justhiro55 requested a review from Copilot June 23, 2025 03:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors various components of the codebase to improve error handling across controllers, use cases, and infrastructure layers. Key changes include adding proper error handling for multipart form parsing, UUID generation, JWT token issuance, and request validations, as well as fixing typos in function names and log messages.

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
file-server/pkg/controller/file.go Updated error handling and response formatting in file uploads
app/usecase/userinfo.go Fixed typo in NewUserinfoUseCase function name
app/usecase/comment.go Fixed typo in NewCommentUseCase function name and improved UUID error handling
app/usecase/auth.go Added error checks for JWT token generation
app/interfaces/server.go Fixed typo in instantiating use cases and handlers
app/interfaces/handler/*.go Replaced error handling via utils.Validate and updated response handling
app/infrastructure/comment.go Updated NewCommentRepository return type for improved type clarity
app/configs/conn.go Fixed typo in log message for failed database connection

return
}

urlName := fmt.Sprintf("http://localhost:3004/%s%s", uuID, file.Filename)

Copilot AI Jun 23, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding an explicit separator (e.g., '/') between the UUID and file.Filename to ensure that the generated URL is always correctly formatted, especially when file.Filename may not start with a '/'.

Suggested change
urlName := fmt.Sprintf("http://localhost:3004/%s%s", uuID, file.Filename)
sanitizedFilename := file.Filename
if len(sanitizedFilename) > 0 && sanitizedFilename[0] == '/' {
sanitizedFilename = sanitizedFilename[1:]
}
urlName := fmt.Sprintf("http://localhost:3004/%s/%s", uuID, sanitizedFilename)

Copilot uses AI. Check for mistakes.
@static-fuji
static-fuji self-requested a review June 30, 2025 06:13
@Justhiro55 Justhiro55 self-assigned this Jul 17, 2025

@static-fuji static-fuji left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGMT

@static-fuji
static-fuji merged commit 1268421 into develop Dec 15, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants