@ -1,6 +1,8 @@
package clients
import (
"database/sql"
"fmt"
"net/http"
"strings"
"sync"
@ -94,6 +96,9 @@ func (c *Clients) loadClientFromDB(userID string) (entry clientEntry, err error)
}
if entry.config, err = c.db.LoadMatrixClientConfig(userID); err != nil {
if err == sql.ErrNoRows {
err = fmt.Errorf("client with user ID %s does not exist", userID)
return
@ -4,9 +4,10 @@ import (
"encoding/json"
"time"
"github.com/matrix-org/go-neb/api"
"github.com/matrix-org/go-neb/types"
)
const schemaSQL = `
@ -10,8 +10,7 @@ func TestProtect(t *testing.T) {
mockWriter := httptest.NewRecorder()
mockReq, _ := http.NewRequest("GET", "http://example.com/foo", nil)
h := Protect(func(w http.ResponseWriter, req *http.Request) {
var array []string
w.Write([]byte(array[5])) // NPE
panic("oh noes!")
})
h(mockWriter, mockReq)