[PR #4945] [MERGED] Make sure to catch the right error so it is displayed on the UI #17561

Closed
opened 2025-11-02 14:04:50 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-gitea/gitea/pull/4945
Author: @adelowo
Created: 9/16/2018
Status: Merged
Merged: 9/16/2018
Merged by: @lafriks

Base: masterHead: catch_the_right_error


📝 Commits (1)

  • c31e9ef make sure to catch the right error so it is displayed as an error on the ui not a 500

📊 Changes

2 files changed (+2 additions, -2 deletions)

View changed files

📝 models/ssh_key.go (+1 -1)
📝 routers/repo/setting.go (+1 -1)

📄 Description

  • Using fmt.Errorf("addDeployKey: %v", err) changes the error type and thus an error page is thrown since it doesn't match all expected cases...
  • Also caught the right error ( ErrDeployKeyAlreadyExist ) instead of a regular ssh key error
screen shot 2018-09-16 at 10 24 04

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-gitea/gitea/pull/4945 **Author:** [@adelowo](https://github.com/adelowo) **Created:** 9/16/2018 **Status:** ✅ Merged **Merged:** 9/16/2018 **Merged by:** [@lafriks](https://github.com/lafriks) **Base:** `master` ← **Head:** `catch_the_right_error` --- ### 📝 Commits (1) - [`c31e9ef`](https://github.com/go-gitea/gitea/commit/c31e9ef5ee3c6d555e9fe09f5a24c8f905083f09) make sure to catch the right error so it is displayed as an error on the ui not a 500 ### 📊 Changes **2 files changed** (+2 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `models/ssh_key.go` (+1 -1) 📝 `routers/repo/setting.go` (+1 -1) </details> ### 📄 Description - Using `fmt.Errorf("addDeployKey: %v", err)` ___changes the error type___ and thus an error page is thrown since it doesn't match all expected cases... - Also caught the right error ( `ErrDeployKeyAlreadyExist` ) instead of a regular ssh key error <img width="1920" alt="screen shot 2018-09-16 at 10 24 04" src="https://user-images.githubusercontent.com/12677701/45594926-fa492580-b99a-11e8-9fb5-fa36db1fa45b.png"> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-02 14:04:50 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#17561