mirror of
https://github.com/jhillyerd/inbucket.git
synced 2026-01-08 20:21:55 +00:00
Missing message is now 404 instead of 500
- Added smtpd.ErrNotExist to make detecting missing message easier - Return 404 instead of 500 when requesting a non-extistant message - More REST unit tests
This commit is contained in:
@@ -1,12 +1,15 @@
|
||||
package smtpd
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/jhillyerd/go.enmime"
|
||||
"io"
|
||||
"net/mail"
|
||||
"time"
|
||||
)
|
||||
|
||||
var ErrNotExist = errors.New("Message does not exist")
|
||||
|
||||
type DataStore interface {
|
||||
MailboxFor(emailAddress string) (Mailbox, error)
|
||||
AllMailboxes() ([]Mailbox, error)
|
||||
|
||||
@@ -176,7 +176,7 @@ func (mb *FileMailbox) GetMessage(id string) (Message, error) {
|
||||
}
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("Message %s not in index", id)
|
||||
return nil, ErrNotExist
|
||||
}
|
||||
|
||||
// Delete all messages in this mailbox
|
||||
|
||||
Reference in New Issue
Block a user