# HG changeset patch # User Mikael Berthe # Date 1492068647 -7200 # Node ID 6ec2a44a1bd140f81a1409cb6f2094d43ab211a8 # Parent 5d803adfc57e3f335ef359d1593db14c6b8da54a Return error rather than empty entities diff -r 5d803adfc57e -r 6ec2a44a1bd1 gondole.go --- a/gondole.go Thu Apr 13 00:17:57 2017 +0200 +++ b/gondole.go Thu Apr 13 09:30:47 2017 +0200 @@ -19,8 +19,10 @@ NoRedirect = "urn:ietf:wg:oauth:2.0:oob" ) +// Error codes var ( - ErrAlreadyRegistered = errors.New("App already registered") + ErrAlreadyRegistered = errors.New("app already registered") + ErrEntityNotFound = errors.New("entity not found") ) // prepareRequest insert all pre-defined stuff diff -r 5d803adfc57e -r 6ec2a44a1bd1 notifications.go --- a/notifications.go Thu Apr 13 00:17:57 2017 +0200 +++ b/notifications.go Thu Apr 13 09:30:47 2017 +0200 @@ -51,6 +51,10 @@ return ¬ification, fmt.Errorf("notification API: %s", err.Error()) } + if notification.ID == 0 { + return nil, ErrEntityNotFound + } + return ¬ification, nil }