aboutsummaryrefslogtreecommitdiffstats
path: root/models/oauth2_application.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/oauth2_application.go')
-rw-r--r--models/oauth2_application.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/models/oauth2_application.go b/models/oauth2_application.go
index 1b544e4e9e..679fdb18f9 100644
--- a/models/oauth2_application.go
+++ b/models/oauth2_application.go
@@ -235,7 +235,7 @@ func deleteOAuth2Application(sess *xorm.Session, id, userid int64) error {
if deleted, err := sess.Delete(&OAuth2Application{ID: id, UID: userid}); err != nil {
return err
} else if deleted == 0 {
- return fmt.Errorf("cannot find oauth2 application")
+ return ErrOAuthApplicationNotFound{ID: id}
}
codes := make([]*OAuth2AuthorizationCode, 0)
// delete correlating auth codes
@@ -261,6 +261,7 @@ func deleteOAuth2Application(sess *xorm.Session, id, userid int64) error {
// DeleteOAuth2Application deletes the application with the given id and the grants and auth codes related to it. It checks if the userid was the creator of the app.
func DeleteOAuth2Application(id, userid int64) error {
sess := x.NewSession()
+ defer sess.Close()
if err := sess.Begin(); err != nil {
return err
}